mardi 24 mars 2015

Rails autopopulates form with database values thus ignoring my model methods

My view:



<%= form_for @product %>
<%= form.text_area :hi %>
<% end %>


My model:



def hi
'hello'
end


Which works properly from console - no matter what :hi attribute really is in the database, it's retrieved as 'hello'.


I guess Rails ignores model method overrides when autopopulating forms? How do I make it pay attention to my override?


Aucun commentaire:

Enregistrer un commentaire