I am still new to development using Rails, and have followed various tutorials. I want to create a simple application using the Ordrin API. I have been stuck at a minute problem for a long time.
Using the Ordrin API makes use of the line:
require 'ordrin'
However, the view related to the controller this occurs in shows the following error.
cannot load such file -- ordrin
Even though I have installed the gem earlier using
gem install ordrin
I have tried using the complete path for the gem returned by the command
gem which ordrin
But then I get an error cannot load such file -- json-schema, which is apparently a dependancy for ordrin.
How do I make the require statement load the default gem as managed by RubyGems?
add the following line in your gem file and try
gem 'ordrin'
and don't forget to run the following command
bundle install
Related
Getting error
/home/sachin/.rvm/gems/ruby-2.3.4/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- dry/types/compat/form_types (LoadError)
While trying 'bundle update' in one of my project.
i have gem 'dry-validation' in my Gemfile
please let me know what is causing this issue because before bundle update it was working fine but now i can not start my rails project.
After commenting the below code it's working fine.
require 'reform/form/dry'
Reform::Form.class_eval do
include Reform::Form::Dry
end
I'm not entirely sure what versions of the gems you are using but this might be your problem.
https://github.com/trailblazer/reform/issues/500
I used the following in my gemfile, to solve the issue i had. Hopefully version 2.3.0 will be released soon.
gem 'reform', github: 'trailblazer/reform', branch: 'v2.3.0.rc2'
Also as a side note, when using 'dry-validation' make sure NOT to use the gem reform-rails as stated in the readme
I'm writing an app that accesses and edits google sheets. I have the same code working in a ruby test file, but when I copy the code line for line to the rails model it throws an error: cannot load such file -- google/apis/sheets_v4 (LoadError)
I have made sure to require google/apis/sheets_v4 and that I'm up to date on 'google-api-client' Both of my files are in the same folder, so they should have access to the same libraries.
The only potential source of error that I have so far is that some part of the app relies on a legacy version of google-api-client, so both 0.4.7 and 0.23.3 are installed. Is there a way to force utilization of one over the other?
The app was developed before my arrival at the company, so I don't know the reasoning for the use of a legacy api (yet).
Try the solution from this github forum to use the version you want:
I had to do
gem 'google-api-client', '~> 0.7.1'
then bundle update google-api-client addressable faraday and that let
me figure out which other gems to update for me to be able to use that
newer gem version. Because of dependencies by default bundle was
installing older version for me.
I'm new to Rails and I got a problem.
My new project requires rb-grib gem (link to ruby gems: https://rubygems.org/gems/rb-grib/versions/0.2.2). This gem requires GRIB API library, I installed it using brew install grib-api. It works in irb and .rb scripts. I need to use it in my Rails app, but I get an error LoadError: cannot load such file -- numru/grib. What I need to do to make it work and deploy to Heroku in future?
You need to add
require 'numru/grib'
I am trying to use this gem in my rails application, but when I add it to my gem file and try to use it I get an error saying that it did not found the methods required (I am using it inside a controller). Also require 'bn4r' does not help as rails tells me that it cannot load such a file, which is odd. I can access the library from the development console with no problems any idea as to why this happens?
After adding the gem to the Gemfile:
gem 'bn4r'
install it:
$ bundle install
Restart the server and use it like this:
BayesNet.new
I'm trying to use the validates_timeliness gem and followed the install instructions in the documentation: https://github.com/adzap/validates_timeliness
gem 'validates_timeliness', '3.0.2'
bundle install
rails generate validates_timeliness:install
I was then able to successfully add rspec tests and get them to pass using the validates_datetime feature from the gem
However, when I go to my new view in a browser, I get the error:
undefined method 'validates_datetime' for #
I also tried adding require 'validates_timeliness' at the top of the model file and then later at the top of the controller file. In those cases I get the error: 'no such file to load -- validates_timeliness
Any help would be much appreciated, have been trying to do extensive googling.
As noted in the instructions, it must be installed as both a plugin and a gem. When installed as a gem alone, seems to work fine with RSpec, but not in the browser.
How I fixed:
So anyone else that runs into this problem may also try running this code from master to install as plugin:
rails plugin install git://github.com/adzap/validates_timeliness.git
adzap/validates_timeliness#installation