Initially looking at the problem suggested a routing bug since as
stated in my first message the output in the log file contained:
Started POST “/login” for 127.0.0.1
even so submitting the login form actually used _method => :put which
in Rails 2.x would have been reported as:
Processing … (for 127.0.0.1) [PUT]
further investigation (after my first post) made clear that the
problem was not related to routing but was due to the way form_for
determines which method to use if not specified.
Since I was NOT using ActiveRecord::Base my Session was NOT responding
to :new_record? which caused form_for adding _method => :put
Now what is the takeaway message here?
- Session should implement a form of new_record? if you want to use
it with form_for OR
- explicitly set the :html => { :method => :post } in form_for so it
doesn’t make wrong guesses
- it may be worth considering changing the logging to actually read:
Started PUT “/login” for 127.0.0.1 IFF the _method parameter is set
to :put
In short, you’re trying to make non ArctiveRecord objects behave like
ActiveRecord. Thus, I would recommend reading the very good write-up
by Yehuda Katz, a Rails core member, because your object, as it stands,
isn’t fully compatible with Rails 3, more specifically, ActionPack:
http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord
Good luck,
-Conrad