Hi - I''d like a simple way to call a method in the controller from a partial that forces a reload of the page. This can be done in one of at least 2 ways- 1) simply use a link_to but can i capture the url of the sending page so I can redirect it back to itself? I want to use this functionality from multiple actions and ids and want to refresh that specific action/ id combo. 2) I can use an ajax call and in the controller, somehow use page.something, but I can''t quite figure this out. Any recommendations? Thanks, Dino --~--~---------~--~----~------------~-------~--~----~ 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 Tue, 2008-03-11 at 19:05 -0700, dino d. wrote:> Hi - > > I''d like a simple way to call a method in the controller from a > partial that forces a reload of the page. This can be done in one of > at least 2 ways- > > 1) simply use a link_to but can i capture the url of the sending page > so I can redirect it back to itself? I want to use this functionality > from multiple actions and ids and want to refresh that specific action/ > id combo. > > 2) I can use an ajax call and in the controller, somehow use > page.something, but I can''t quite figure this out. > > Any recommendations?---- does this do anything for you (controller code)? redirect_to :back, :params => @params Craig --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
How about: link_to ''Refresh page'', :action => controller.controller_action Just doing it off the top of my head, but you get the idea. Jamey On Tue, Mar 11, 2008 at 10:22 PM, Craig White <craigwhite-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote:> > On Tue, 2008-03-11 at 19:05 -0700, dino d. wrote: > > Hi - > > > > I''d like a simple way to call a method in the controller from a > > partial that forces a reload of the page. This can be done in one of > > at least 2 ways- > > > > 1) simply use a link_to but can i capture the url of the sending page > > so I can redirect it back to itself? I want to use this functionality > > from multiple actions and ids and want to refresh that specific action/ > > id combo. > > > > 2) I can use an ajax call and in the controller, somehow use > > page.something, but I can''t quite figure this out. > > > > Any recommendations? > ---- > does this do anything for you (controller code)? > > redirect_to :back, :params => @params > > Craig > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> link_to ''Refresh page'', :action => controller.controller_action >Thanks for the replies. But neither seems to do what I want. Maybe I''m just not seeing the right approach so let me explain the problem. I''m building a blog applicayion that lets a user subscribe to another user''s posts. Next to a post, I have a link for "subscribe to this users posts" and originally, I had implemented it in ajax. When a user clicked on it, it would just refresh that div and say "You are subscribing to this user''s posts." But, if that user had another post on the page, you would get inconsistent feedback. Is there a better way to deal with this than a page refresh? Thanks, Dino> Just doing it off the top of my head, but you get the idea. > > Jamey > > On Tue, Mar 11, 2008 at 10:22 PM, Craig White <craigwh...-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote: > > > On Tue, 2008-03-11 at 19:05 -0700, dino d. wrote: > > > Hi - > > > > I''d like a simple way to call a method in the controller from a > > > partial that forces a reload of the page. This can be done in one of > > > at least 2 ways- > > > > 1) simply use a link_to but can i capture the url of the sending page > > > so I can redirect it back to itself? I want to use this functionality > > > from multiple actions and ids and want to refresh that specific action/ > > > id combo. > > > > 2) I can use an ajax call and in the controller, somehow use > > > page.something, but I can''t quite figure this out. > > > > Any recommendations? > > ---- > > does this do anything for you (controller code)? > > > redirect_to :back, :params => @params > > > Craig--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---