How to use form_tag with a model?

Editing records of my model requires an intermediate layer of software,
so I cannot use form_for for data aqusition.

My edit action calls the form. But submitting the data always ends with
a "Unknown action" response:

   No action responded to 6. Actions: create, destroy, edit, index, new,
show,
   and update

6 is the id of the record to be edited.
The URL is http://localhost:3000/finders/6

Here are the relevant snippets of code:

controller:
    def edit
      @finder = Finder.find(params[:id]) # a record of the model
    end

view:
   <% form_tag(:action => 'update', :id => @finder.id ) do %>
  <%= submit_tag 'store' %>
   <% end %>

routes.rb:
ActionController::Routing::Routes.draw do |map|
  map.resources :finders

  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
end

Any idea, how to fix it?

Editing records of my model requires an intermediate layer of software,
so I cannot use form_for for data aqusition.

I'm not sure that's true (you don't have to use the form builder for
the actual inputs), but the core issue is probably that it's expecting
the update to be a PUT request.

Fred

Frederick Cheung wrote:

I'm not sure that's true (you don't have to use the form builder for
the actual inputs), but the core issue is probably that it's expecting
the update to be a PUT request.

Adding a :method => 'PUT' doesn't help.

Should that be :put?

Colin

Colin Law wrote:

Should that be :put?

No, I tested all possible variants: nothing helps.
<% form_tag(:action => "update", :method => :put ) do %>
generates
<form action="/finders/6?method=put" method="post">
and doesn't work.

When I manually enter the URL http://localhost:3000/finders/6/update
then update gets called.

But how to force form_tag to generate this action URL?

Ok, I got it:

<% form_tag({ :action => "update" }, {:method => :put} ) do %>

ends up in update.