Ruby on Rails Monday, December 1, 2014

On Dec 1, 2014, at 10:32 AM, Roelof Wobben <rwobben@hotmail.com> wrote:

> Hello,
>
> I did all the steps from the Hartl tutorial but as soon as I do this :
>
> User.create(name: "Michael Hartl", email: "mhartl@example.com",password: "foobar", password_confirmation: "foobar")
>
> on the rails console, I see this error message :

Make sure that your Gemfile looks EXACTLY the same as Señor Hartl's. I am betting you are missing the bcrypt library. (It's commented out in a default `rails new` generated site.

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'


Walter

> NoMethodError: undefined method `password_digest=' for #<User:0x00000004489fc8>
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activemodel-4.2.0.beta4/lib/active_model/attribute_methods.rb:435:in `method_missing'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activemodel-4.2.0.beta4/lib/active_model/secure_password.rb:125:in `password='
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activerecord-4.2.0.beta4/lib/active_record/attribute_assignment.rb:54:in `public_send'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activerecord-4.2.0.beta4/lib/active_record/attribute_assignment.rb:54:in `_assign_attribute'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activerecord-4.2.0.beta4/lib/active_record/attribute_assignment.rb:41:in `block in assign_attributes'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activerecord-4.2.0.beta4/lib/active_record/attribute_assignment.rb:35:in `each'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activerecord-4.2.0.beta4/lib/active_record/attribute_assignment.rb:35:in `assign_attributes'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activerecord-4.2.0.beta4/lib/active_record/core.rb:556:in `init_attributes'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activerecord-4.2.0.beta4/lib/active_record/core.rb:277:in `initialize'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activerecord-4.2.0.beta4/lib/active_record/inheritance.rb:61:in `new'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activerecord-4.2.0.beta4/lib/active_record/inheritance.rb:61:in `new'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activerecord-4.2.0.beta4/lib/active_record/persistence.rb:33:in `create'
> from (irb):4
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/railties-4.2.0.beta4/lib/rails/commands/console.rb:110:in `start'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/railties-4.2.0.beta4/lib/rails/commands/console.rb:9:in `start'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/railties-4.2.0.beta4/lib/rails/commands/commands_tasks.rb:68:in `console'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/railties-4.2.0.beta4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/railties-4.2.0.beta4/lib/rails/commands.rb:17:in `<top (required)>'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:252:in `require'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:252:in `block in require'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:237:in `load_dependency'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:252:in `require'
> from /home/ubuntu/workspace/sample_app/bin/rails:8:in `<top (required)>'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:246:in `load'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:246:in `block in load'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:237:in `load_dependency'
> from /usr/local/rvm/gems/ruby-2.1.4@rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:246:in `load'
> from /usr/local/rvm/rubies/ruby-2.1.4/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
> from /usr/local/rvm/rubies/ruby-2.1.4/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
>
> Roelof
>
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/13a9046e-8e2f-4472-84db-0e06849f3db3%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/F7680F0B-5242-4586-AC18-2E4748FE253C%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment