I'm using the console to debug my rails app. I'm using 'Session' now instead of 'Cookies' (it worked fine with Cookies), but it's now giving me an error complaining it can't find the 'session' method. How do I get my console instance to recognize the Session methods?
>> app.sign_in user
NoMethodError: undefined method `session' for nil:NilClass
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/
whiny_nil.rb:52:in `method_missing'
from /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/
test_process.rb:469:in `session'
from /home/dan/rails_projects/sample_app/app/helpers/sessions_helper.rb:
7:in `sign_in'
from (irb):5
Here is my sign_in method in the SessionsHelper:
def sign_in(user)
session[:user_id] = user.id
self.current_user = user
end
I'm using this code to 'initiate' the console:
include SessionsHelper
user = User.find_by_email("[email protected]")
app.sign_in user