How to force the method for a formtastic form to be put?

pupeno picture pupeno · Jan 5, 2011 · Viewed 9k times · Source

I have something like

semantic_form_for @whatever, :url => whatever_url

which generates a from with

method="post"

I need it to be put, I've already tried:

semantic_form_for @whatever, :url => whatever_url, :html => {:method => "put"}

and

semantic_form_for @whatever, :url => whatever_url, :html => {:method => :put}

and

semantic_form_for @whatever, :url => whatever_url, :html_args => {:method => :put}

with no effect. Any ideas how it's done?

Answer

BvuRVKyUVlViVIc7 picture BvuRVKyUVlViVIc7 · Jan 6, 2011

See http://www.rubydoc.info/gems/formtastic/0.9.10/Formtastic/SemanticFormHelper and try:

  <% semantic_form_for :whatever, @whatever :url => posts_path, :html => {:method => :put} do |f| %>
    ...
  <% end %>