I have an application that worked in rails 2.3.8, but now trying to convert to rails 3 and things aren't working like I would expect.
I have a model (and table) called 'session_log' (model is SessionLog). This table contains information about the current user (logged in status, User ID etc.).
In additon, I used the command rake:db:sessions:create which created the table 'sessions'. I'm not sure I understand the implications of this completely but don't think that is impacting what I'm dealing with.
The issue is that in the application_controller.rb file, I have a method defined as follows:
session_log = SessionLog.create
session[:session_log_id] = session_log.id
This code is mostly copied from the agile web development book (for rails 3).
the code in the controller that calls this method is as follows:
@current_session = get_session
When I run this code, I get an error 'wrong number of arguments (1 for 0)' and I can't figure out why this would be the case.
The get_session method does not expect (nor do I pass) an argument. the only thing I could think of is that the .create method was
expecting an argument, although I've read code examples that suggest this isn't the case.
I tried using .new (session_log = SessionLog.new) instead, and get a different error 'You have a nil object when you didn't expect it' and 'you might have an instance of ActiveRecord::Base'.
Any help in pointing me in the right direction would be appreciated