Rails 4 without model and database

I want to create a form in HAML, but I do not have a model table or database. The form should just send its fields via POST to the action, and I will process it from there. As far as I can tell, form_for should have a record .

What is the best practice for this?

+7
ruby-on-rails-4
source share
1 answer

form_for can also accept an arbitrary character:

 <%= form_for :anything, url: "my_controller/my_action" do |form| %> <%= form.text_field :name %> <%= form.submit %> <% end %> 

This will send a message to my_controller/my_action .

The html output will look something like this:

 <form accept-charset="UTF-8" action="my_controller/my_action" method="post"> <input id="anything_name" name="anything[name]" type="text"> <input name="commit" type="submit" value="Save Testing"> </form> 
+16
source share

All Articles