Hi everyone,
I’m working through the tutorial at the following link and attempting to
customise/adapt the lessons for my own slightly different application.
Link:
Ruby on Rails Tutorial: Learn Rails by Example | Ruby on Rails 3
Tutorial book and screencasts | by Michael H.
http://ruby.railstutorial.org/ruby-on-rails-tutorial-book
I’m currently trying to work through chapter 10, but having some
problems with the variable ‘current_user’ not being properly defined in
the ‘signed_in’ method. Everything looks fine to me, but as I am
obviously missing something I’d appreciate it if someone with more
experience at debugging could point me in the right direction.
I can sign in with my test users and the exception only occures when
attempting to edit a profile.
Controller and model are attached.
Cheers,
Jen.
Error:
NameError in UsersController#edit
undefined local variable or method `current_user’ for
#UsersController:0x9ffad80
|Rails.root: /home/resource_portal/website|
Application Trace http://localhost:3000/users/1/edit# | Framework
Trace http://localhost:3000/users/1/edit# | Full Trace
http://localhost:3000/users/1/edit#
|app/helpers/sessions_helper.rb:17:in signed_in?' app/controllers/users_controller.rb:91:in
authenticate’
rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/callbacks.rb:436:in
_run__1056153724__process_action__372525482__callbacks' rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/callbacks.rb:409:in
_run_process_action_callbacks’
rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/callbacks.rb:93:in
run_callbacks' rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/abstract_controller/callbacks.rb:17:in
process_action’
rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/action_controller/metal/instrumentation.rb:30:in
block in process_action' rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/notifications.rb:52:in
block in instrument’
rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/notifications/instrumenter.rb:21:in
instrument' rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/notifications.rb:52:in
instrument’
rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/action_controller/metal/instrumentation.rb:29:in
process_action' rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/action_controller/metal/rescue.rb:17:in
process_action’|
…