Hi,
Moved the authenticate method to the helper, after looking at the sample
app code from github. This seems to have solved the problem.
Thanks,
Jen.
On 13/06/11 14:49, Simon Baumgartner wrote:
Are you including SessionsHelper in you ApplicationController ?
class ApplicationController< ActionController::Base
protect_from_forgery
include SessionsHelper
end
Simon
On Jun 12, 3:43 pm, Jen<jen.bot...@gmail.com> wrote:
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 Hartl
<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/callbac
ks.rb:17:in `process_action'
rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/action_controller/metal/ins
trumentation.rb:30:in `block in process_action'
rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/notificat
ions.rb:52:in `block in instrument'
rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/notificat
ions/instrumenter.rb:21:in `instrument'
rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/notificat
ions.rb:52:in `instrument'
rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/action_controller/metal/ins
trumentation.rb:29:in `process_action'
rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/action_controller/metal/res
cue.rb:17:in `process_action'|
...
users_controller.rb
2KViewDownload
sessions_helper.rb
1KViewDownload
--
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@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.