Rails 3 / Form without Model: How do I create a form that is not tied to a model?

Use form_tag instead of form_for, then use the appropriate form helpers: text_field_tag instead of f.text_field, text_area_tag instead of f.text_area, etc. Example:

<%= form_tag "/my_controller/update2" do %>
  <%= text_field_tag "account", "default info" %>
  <%= submit_tag "Save" %>
<% end %>

The Rails API site has a great reference to all of the _tag helpers: http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)