Hi. I have a link_to_remote that should call a function in controller that updates the page using rjs. The links are not hitting the controller. I click on the link and nothing happens in the log file. I suspect it is something small and silly in my syntax. I would appreciate if someone could glance over the code and see if they can spot it - here it is: rhtml: <%= link_to_remote "YES", :url => {:controller => ''users'', :action => ''toggle_user_roles'', :params => {:user_id => user.id, :role_id => role.id, :has_role => true}}%> html: <td id=''1_1'' style="text-align:center;" class="yes_style"> <a href="#" onclick="new Ajax.Request(''/users/toggle_user_roles/:id.:format?role_id=1&has_role=true&user_id=1'', {asynchronous:true, evalScripts:true}); return false;">YES</a> </td> The problem is not in the controller as this onClick does not actually reach the controller. thanks in advance ivor --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Please check if you included the appropriate public/javascripts(/ prototype) files in your view .. Add this line in the view: <%= javascript_include_tag :defaults %> It is a good idea to put this line in the layout file (/app/views/ layout/application.rhtml), so that all the javascripts would be available in all the views... -- askme On Mar 23, 11:13 am, "Ivor Paul" <ivorp...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi. > > I have a link_to_remote that should call a function in controller that > updates the page using rjs. > > The links are not hitting the controller. I click on the link and nothing > happens in the log file. I suspect it is something small and silly in my > syntax. > > I would appreciate if someone could glance over the code and see if they can > spot it - here it is: > > rhtml: > > <%= link_to_remote "YES", > :url => {:controller => ''users'', > :action => ''toggle_user_roles'', > :params => {:user_id => user.id, :role_id => role.id, > :has_role => true}}%> > > html: > > <td id=''1_1'' style="text-align:center;" class="yes_style"> > <a href="#" onclick="new > Ajax.Request(''/users/toggle_user_roles/:id.:format?role_id=1&has_role=true&user_id=1'', > {asynchronous:true, evalScripts:true}); return false;">YES</a> > </td> > > The problem is not in the controller as this onClick does not actually reach > the controller. > > thanks in advance > ivor--~--~---------~--~----~------------~-------~--~----~ 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 it''s because of this part in the Ajax.Request: :id.:format It looks strange and I don''t think it should be there. It could have to do something with routing...? Mischa. -- http://boxroom.rubyforge.org -- 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 -~----------~----~----~----~------~----~------~--~---
lol! thanks, it was working seconds ago, then I decided I wanted to use a different layout, made some other minor changes and suddenly it didn''t work :) Thanks for the help! ivor On 3/23/07, askme <ChaitanyaPrakash.N-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Please check if you included the appropriate public/javascripts(/ > prototype) files in your view .. > Add this line in the view: > <%= javascript_include_tag :defaults %> > > It is a good idea to put this line in the layout file (/app/views/ > layout/application.rhtml), so that all the javascripts would be > available in all the views... > > -- askme > > On Mar 23, 11:13 am, "Ivor Paul" <ivorp...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi. > > > > I have a link_to_remote that should call a function in controller that > > updates the page using rjs. > > > > The links are not hitting the controller. I click on the link and > nothing > > happens in the log file. I suspect it is something small and silly in my > > syntax. > > > > I would appreciate if someone could glance over the code and see if they > can > > spot it - here it is: > > > > rhtml: > > > > <%= link_to_remote "YES", > > :url => {:controller => ''users'', > > :action => ''toggle_user_roles'', > > :params => {:user_id => user.id, :role_id => role.id, > > :has_role => true}}%> > > > > html: > > > > <td id=''1_1'' style="text-align:center;" class="yes_style"> > > <a href="#" onclick="new > > Ajax.Request > (''/users/toggle_user_roles/:id.:format?role_id=1&has_role=true&user_id=1'', > > {asynchronous:true, evalScripts:true}); return false;">YES</a> > > </td> > > > > The problem is not in the controller as this onClick does not actually > reach > > the controller. > > > > thanks in advance > > ivor > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
it was because id did not include the js libraries. the :id.:format is because I am sending 2 params accross, not just the default :id, me things... On 3/23/07, Mischa Berger <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > I think it''s because of this part in the Ajax.Request: :id.:format > > It looks strange and I don''t think it should be there. It could have to > do something with routing...? > > Mischa. > > -- > http://boxroom.rubyforge.org > > -- > 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 -~----------~----~----~----~------~----~------~--~---