Reputation: 303
<%= text_area_tag :body_html, "", :class =>"required mceEditor", :id=>"txaEditableContent" %>
This is my code. I want this text_area_tag to be assigned to an object(object is note in my case) just like we use "form_for object" so that the :body_html goes straight into params[:note] on submit. How can I do this?
Upvotes: 0
Views: 178
Reputation: 15788
You have got to set first an instance of Note in the controller corresponding action:
@note = Note.new
Then, in your view put this form:
<%= form_for @note do |f| %>
<%= f.text_area :body_html, :class => "required mceEditor", :id => "txaEditableContent" %>
<%= f.submit "Submit" %>
<% end %>
Now when you click the submit button you should get the right post request as you needed.
Upvotes: 2