Given the following example:
class AnonymousSession << Struct.new(:location, :preferences)
def valid?
...
end
def new_record?
...
end
end
While this interface is sufficient to create resourceful form and so on, it fails as soon as I want to save my form data to the session:
if session[:user] = AnonymousSession.create(params[:anonymous_session])
#--> fails with "unknown key(s): location..."
...
end
The error message is about "unknown keys". Any clue how to make it work? I just need anonymous sessions without database backend. They are completely disposable due to their short live nature.
Maybe my approach is wrong anyway and there's already an elegant solution to using anonymous sessions? I had a look at AuthLogic but any example I found always comes with an ActiveRecord model (and thus bound to a database).