Hi All. I am trying to set-up observe_field so that it uses the GET method (To work with a RESTful controller). <%= link_to_remote("Test", :update => "main", :url => { :controller => "projects", :action => "show", :id => "3"}, :method => "get" ) %> <%= observe_field("project_selector", :update => "main", :url => { :controller => "projects", :action => "show"}, :with => "''id=''+escape(value)") %> I have successfully set-up a link_to_remote so that it works (although I had to replace the project_path URL with the :controller and :action) as you can see above however I cannot for the life of me get the observe_field to work. (Putting :method => ''get'' into the :url hash doesn''t work) Looking at the API there is no html_options specified in the observe field method so I am wondering if it is possible and I am missing something or do I need to submit a ticket on edge rails to get all the prototype helpers updated to allow a :method for RESTful compatibility. Any help would be much appreciated Thanks RJ -- 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 -~----------~----~----~----~------~----~------~--~---
I think that :method => ''get'' is what you want - But it doesn''t need to go in the :url hash. It should be just like link_to_remote, i.e. observe_field("project_selector", :method => ''get'', etc...) The ajax prototype helpers end up calling options_for_ajax which is clearly looking out for the presence of a method parameter. Fred -- 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> I think that :method => ''get'' is what you want - But it doesn''t need to > go in the :url hash. It should be just like link_to_remote, i.e. > observe_field("project_selector", :method => ''get'', etc...) > The ajax prototype helpers end up calling options_for_ajax which is > clearly looking out for the presence of a method parameter. > > FredHoi Fred. I was afraid that would be the answer :) When I do this (and have done this in the past) the request seems to get screwed up as you can see from the log below: Processing ProjectsController#index (for 127.0.0.1 at 2006-11-05 08:16:06) [GET] Session ID: 2a9b3a8394f406523f33929918b93099 Parameters: {"action"=>"index", "id"=>"3", "controller"=>"projects", "_"=>nil} The request is correctly sent as a GET but the action gets changed to "index" and a "_"=>nil parameter is created for some reason. Before I started raising tickets I wanted to be sure it is a problem with edge rather than me just not understanding the helpers. Does anyone know what is causing this? Many thanks RJ -- 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 -~----------~----~----~----~------~----~------~--~---
priit.tamboom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Nov-09 07:49 UTC
Re: how to get observe_field to use GET method?
I''m stuck in the same problem with GET, observer_field and REST controller with the "_" stuff (some days already :-) Have you got any solution or did you raised the ticket? Priit --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
priit.tamboom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> I''m stuck in the same problem with GET, observer_field and REST > controller with the "_" stuff (some days already :-) > > Have you got any solution or did you raised the ticket? > > PriitI have raised a ticket although the description is slightly different. I believe the action is going to "index" because the "id" parameter in :with is not honoured by the restful controller as a proper ID (in that it doesn''t use the id value specified in the :with hash to construct the URL which, with a restful get request, means that it goes to the index). I am still a relative newbie so if you can add some better details it will probably help http://dev.rubyonrails.org/ticket/6553 -- 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 -~----------~----~----~----~------~----~------~--~---