mike
2012-May-13 00:08 UTC
undefined method `key?'' for nil:NilClass,bcrypt-ruby,has_secure_password
I''m going through DHH''s Agile Web Development with Rails for Rails 3.1. In chapter 14 they create a Users sign-in model/view/controller using the has_secure_password method. My user.rb file looks like this class User < ActiveRecord::Base attr_accessible :name, :password_digest, :password, :password_confirmation validates :name, presence: true, uniqueness: true has_secure_password end now when I go to localhost:3000/users/new I first get some kind of bcrypt-ruby error and then when I reload the page I get a undefined method `key?'' for nil:NilClass I don''t know what needs to be done, mike -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/H4lsZNIa2ykJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Greg Akins
2012-May-13 00:43 UTC
Re: undefined method `key?'' for nil:NilClass,bcrypt-ruby,has_secure_password
On Sat, May 12, 2012 at 8:08 PM, mike <mikeglaz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> now when I go to localhost:3000/users/new I first get some kind of > bcrypt-ruby error and then when I reload the page I get a undefined method > `key?'' for nil:NilClass >Please post the bcrypt-ruby error you''re seeing and the full trace from the ''undefined Method'' error -- Greg Akins http://twitter.com/akinsgre -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Javier Quarite
2012-May-13 02:16 UTC
Re: undefined method `key?'' for nil:NilClass,bcrypt-ruby,has_secure_password
On Sat, May 12, 2012 at 7:43 PM, Greg Akins <angrygreg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sat, May 12, 2012 at 8:08 PM, mike <mikeglaz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > now when I go to localhost:3000/users/new I first get some kind of > > bcrypt-ruby error and then when I reload the page I get a undefined > method > > `key?'' for nil:NilClass > > > >I got (still gettin) that error with device. I''m changing a rails app from 2.3 to 3.2 and it seems that devise uses another type of encryption (I''m not sure I discovered 2 days ago). The only way I log in is using the console: User.find(1).update_attributes(:password=>"newpassword",:password_confirmation=>"newpassword") and after that I can log in without any trouble but I have to take a look at this error. Maybe it helps you :) Javier Q -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
dasibre
2012-May-13 12:04 UTC
Re: undefined method `key?'' for nil:NilClass,bcrypt-ruby,has_secure_password
did you install the bcrypt gem. Make sure its added to your gemfile then run bundle install..... On May 12, 8:08 pm, mike <mikeg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m going through DHH''s Agile Web Development with Rails for Rails 3.1. In > chapter 14 they create a Users sign-in model/view/controller using the > has_secure_password method. My user.rb file looks like this > > class User < ActiveRecord::Base > attr_accessible :name, :password_digest, :password, :password_confirmation > validates :name, presence: true, uniqueness: true > has_secure_password > end > > now when I go to localhost:3000/users/new I first get some kind of > bcrypt-ruby error and then when I reload the page I get a undefined method > `key?'' for nil:NilClass > > I don''t know what needs to be done, mike-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
mike
2012-May-14 02:31 UTC
Re: undefined method `key?'' for nil:NilClass,bcrypt-ruby,has_secure_password
I think I figured out what happened. I installed bcrypt-ruby and ran bundle install but never restarted the server. Everything''s working now. On Saturday, May 12, 2012 7:08:33 PM UTC-5, mike wrote:> > I''m going through DHH''s Agile Web Development with Rails for Rails 3.1. In > chapter 14 they create a Users sign-in model/view/controller using the > has_secure_password method. My user.rb file looks like this > > class User < ActiveRecord::Base > attr_accessible :name, :password_digest, :password, :password_confirmation > validates :name, presence: true, uniqueness: true > has_secure_password > end > > now when I go to localhost:3000/users/new I first get some kind of > bcrypt-ruby error and then when I reload the page I get a undefined method > `key?'' for nil:NilClass > > I don''t know what needs to be done, mike >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/ICR6IJBHDD8J. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.