Hello all, Im tryng to create a remote_form_for in a restful app, but cant get the method to be put. It appears to default to post if the value is not post or get. is there a trick to this or does form_for_remote not have non get/post methods. i tried to add the hidden field forcably but wasnt sure on the syntax. i know i need this output. <input type="hidden" value="put" name="_method"/> for the following :method values i get these when inspecting the rendered page: rhtml>>>>>>>>>>>>>>>>>>>>>>> Rendered HTML :method => ''put''>>>>>>>>>> method="post" :method => ''sfsdfsdf''>>>>> method="post" :method => ''get''>>>>>>>>>>> method="get" form_remote_for usage: <pre> <% form_remote_for( :track, track, :url => track_path(track_edit), :html => { :method => ''put''}) do |f| %> form stuff here <%= image_submit_tag ''icons/arrow_refresh'' %> <% end %> </pre> -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
mcintyre.tim-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jan-23 18:23 UTC
Re: form_remote_for can do :put
I''ve just been doing stuff like this: <% form_remote_for(:track, :url => track_path(:id => track.id), :method => "PUT") do |f| %> been working fine for me:-) Tim --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
unknown wrote:> I''ve just been doing stuff like this: > > <% form_remote_for(:track, > :url => track_path(:id => track.id), > :method => "PUT") do |f| %> > > been working fine for me:-) > Timhey tim thanks for the reply. Really? Yours works. Hmmmm. I was under the impression that the :id assignment was implied through order. In this case there is no nesting so i figured track was assigned to id. Im begging to think that the fact that i have the form nested in a row of a table, im getting errors there. I checked and there is a list of _method put hidden fields further up.. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
mcintyre.tim-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jan-24 04:57 UTC
Re: form_remote_for can do :put
On Jan 23, 2:23 pm, Adam Madd <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> unknown wrote: > > I''ve just been doing stuff like this: > > > <% form_remote_for(:track, > > :url => track_path(:id => track.id), > > :method => "PUT") do |f| %> > > > been working fine for me:-) > > Timhey tim thanks for the reply. > > Really? Yours works. Hmmmm.Yep, I''m using that syntax in a good number of places. It does the HTTP PUT and everything works fine.> > I was under the impression that the :id assignment was implied through > order. In this case there is no nesting so i figured track was assigned > to id.Sorry I''m not completely following you here, however you definitely need to pass the :id to singular_word_path() when you want to do a an update (e.g. HTTP PUT).> > Im begging to think that the fact that i have the form nested in a row > of a table, im getting errors there. I checked and there is a list of > _method put hidden fields further up..I haven''t tried to do anything with hidden fields in this regaurd but I suspect it''s throwing you off track, not really sure. good luck Tim> > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
unknown wrote:> On Jan 23, 2:23 pm, Adam Madd <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> Really? Yours works. Hmmmm. > Yep, I''m using that syntax in a good number of places. It does the > HTTP PUT and everything works fine. > >> >> I was under the impression that the :id assignment was implied through >> order. In this case there is no nesting so i figured track was assigned >> to id. > > Sorry I''m not completely following you here, however you definitely > need to pass the :id to singular_word_path() when you want to do a an > update (e.g. HTTP PUT). > >> >> Im begging to think that the fact that i have the form nested in a row >> of a table, im getting errors there. I checked and there is a list of >> _method put hidden fields further up.. > > I haven''t tried to do anything with hidden fields in this regaurd but I > suspect it''s throwing you off track, not really sure. > > good luck > TimThanks again for your help. The hidden fields were added automatically from the form_remote_for when i specified put as the method. I have started down a in_place_edit path at the moment which is proving equally difficult under rest. I will try the remote_form_for again. Adam -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 1/23/07, Adam Madd <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > unknown wrote: > > I''ve just been doing stuff like this: > > > > <% form_remote_for(:track, > > :url => track_path(:id => track.id), > > :method => "PUT") do |f| %> > > > > been working fine for me:-) > > TimI can''t get that to work for me. I ''ve been using the :html hash for passing the PUT method as a hidden field. I''ve found this method in the Beast forum and it seems to work. Though, it does seem like you should be able to pass the :method param and have it override POST. Anyone else have experience with this? Ed --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ed Hickey wrote:> On 1/23/07, Adam Madd <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> > Tim > I can''t get that to work for me. I ''ve been using the :html hash for > passing the PUT method as a hidden field. I''ve found this method in the > Beast forum and it seems to work. Though, it does seem like you should > be > able to pass the :method param and have it override POST. > > Anyone else have experience with this? > > EdI was having a similar problem and in the end it was because prototype.js wasn''t loading and it was sending the form request as GET instead of POST (or pseudo PUT depends on how you want to think about it) in my .htaccess I added this rule RewriteCond %{REQUEST_URI} ^/javascripts.* RewriteRule .* - [L] Which allowed prototype.js to load and it worked. Hope this helps someone! -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---