Gemfile:
gem 'values'
Also tried Gemfile:
gem 'values', require: 'values'
Gemfile.lock
values (1.8.0)
$ bundle install
Using values 1.8.0
But $ rails console
> Value
NameError (uninitialized constant Value)
> require 'values'
LoadError (cannot load such file -- values)
But if I just $ irb
require 'values'
=> true
How can I get to the Value object in rails?
Previously I faced such problem for awesome_print gem, the issue is due to spring preloader.
First, you need to stop spring from a terminal using the following command.
spring stop
Then restart your rails console.
Hope this will help for you.
Related
I am using pry for rails console.
Whenever I evaluate some value in console, NoMethodError is raised in bindings_equal?, that is a method of pry-stack_explorer gem. The input and output is as follows.
That is not harmful but a nuisance. I want to remove it.
Can anyone help?
> bundle exec rails console
Loading development environment (Rails 4.1.5)
Frame number: 0/21
[1] pry(main)>
[2] pry(main)>
[3] pry(main)> 1
when_started hook failed: NoMethodError: private method `eval' called for nil:NilClass
{My Bundle Directory}/ruby/2.1.0/gems/pry-stack_explorer-0.4.9.1/lib/pry-stack_explorer.rb:109:in `bindings_equal?'
(see _pry_.hooks.errors to debug)
=> 1
[4] pry(main)>
I use these gems relating to pry:
gem 'pry-rails'
gem 'pry-remote'
gem 'pry-byebug'
Thank you.
I had to add
require 'awesome_print'
AwesomePrint.pry!
to my ~/.pryrc (per the AwesomePrint docs) to fix this error.
Some are mentioning removing Pry.config.print from their ~/.pryrc but I didn't even have a ~/.pryrc, so it appears this can happen by just using awesome_print and pry together.
I'm not running the same gems as you, but have run across the same error.
I started an issue on the github project
When I add
require 'soundcloud'
in Rails and start the server using
rails server
I get
...rb:9:in `require': cannot load such file -- soundcloud (LoadError)
the same yields
=> true
in IRB.
I installed Ruby, Rails, etc following http://installrails.com/.
Any ideas what could be causing this?
Why don't you use Bundler?
Add to Gemfile:
gem 'soundcloud'
then run
bundle install
in the root of your project and it all should work automatically.
trying to use in rails3.2.14 and ruby 1.9.3
added gem ’preferences’ to Gemfile and did bundle install
And as per the gem document I do the following step
rails generate migration create_preference
ran rake db:migrate
restarted rails server
added some preference to user model
preference :publish_profile, :default => true
But when tried to access a preference using
#user.prefers_publish_profile
I got uninitialized constant Preferences::InstanceMethods::Preference
Here is the gem url:-
https://github.com/pluginaweek/preferences
The problem will besolved by using rails3 branch gem
gem "preferences", :git
=>"git#github.com:skyeagle/preferences.git",:branch =>"rails3"
Thanks
I'm currently doing Michael Hardtl's Rails Tutorial and in chapter 7 there is a section of code that begins with require 'digest'. I run sudo gem install digest and get this error that the digest gem cannot be found.
I've Googled around and there doesn't seem to be any leads as to what this gem changed to. Any ideas of how to proceed?
It's not a gem but part of the ruby standard library
Depending the ruby version you are running, you don't need to make this require.
If you are running ruby 1.9.3~ for example.
You can try at console:
Loading development environment (Rails 3.2.3)
1.9.3-p125 :001 > Digest::SHA2.hexdigest("test")
=> "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08" //result
1.9.3-p125 :002 >
I have installed the gem : oauth2
I can load it in irb:
$ irb -rubygems
irb(main):001:0> require 'oauth2'
=> true
I have :
require 'rubygems'
in my code
and have set RUBYOPT :
export RUBYOPT=rubygems
while I still get the error:
LoadError in XXXController#login
no such file to load -- oauth2
Any help will be appreciated.
Did you specify the gem as a dependency in Rails?
If you are using Rails 3, make sure the gem is listed in your Gemfile and you successfully executed the command $ bundle install.