Why the f... is form_for with a new non-active record model posting to 'create'-action?
While in Rails3 Active Model takes care of all the Active Record Goodies which you might also need in non-activerecord / non-database Models, you sometimes have to trick on older Rails Versions.
For example using form_for tries to call the ‘new_record?’ method on the model, and will not treat it as a new model unless it returns true.
In my case the non-activerecord model was only used to send Invitations to friends. There was no need to ever edit it again, so i could help myself by simply adding
def new_record? true end
to my Invitation Model.
Trackbacks
Verwenden Sie den folgenden Link zur Rückverlinkung von Ihrer eigenen Seite:
http://praktikanten.brueckenschlaeger.org/trackbacks?article_id=235