I have a form_for like so:
<%= form_for(@post) do |f| %>
I would like to submit a parameter that is not an attribute of the model
<%= f.text_field :label%>
I have a Label model (labels has_many :posts and posts has_many :labels) and in the create action of the posts_controller I want to create a new Label object based off the label text_field. With the above text_field I get:
undefined method `label'for #<Object>
How can I go about achieving this?
Thanks in advance!
If your attribute doesn’t exist into database table, and still you want to use it, then you have specify that attribute into model by following way