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?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
On Aug 16, 6:17 pm, Fritz Trapper <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 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> 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 ishttp://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? > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 16 August 2010 18:37, Fritz Trapper <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ok, I got it:
<% form_tag({ :action => "update" }, {:method => :put} ) do
%>
ends up in update.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.