Hello all, I need to call page.replace_html in every Ajax call. Is there a way to do this in some after_filter ? I tried a render :update do |page| in after_filter, but it says that can only render once per action.... Thanks in advance.... Parra --~--~---------~--~----~------------~-------~--~----~ 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 2/12/07, Marcello Parra <parra06-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello all, > > I need to call page.replace_html in every Ajax call. > Is there a way to do this in some after_filter ? > > I tried a render :update do |page| in after_filter, but it says that > can only render once per action.... >I haven''t tried it but I bet you can do: def my_after_filter response.body << update_page do |page| page[''element-id''].replace render :partial => "blah" end end Chad --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Marcello Parra wrote:> I need to call page.replace_html in every Ajax call. > Is there a way to do this in some after_filter ?Given render :update do |page|, page is just a variable. You can pass it into a shared function, and that can then do both specific and generic stuff to it, following typical OO design techniques. -- Phlip http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks Chad, But that gives an undefined method `update_page'' error.... I could not find the problem.... Parra> > I haven''t tried it but I bet you can do: > > def my_after_filter > response.body << update_page do |page| > page[''element-id''].replace render :partial => "blah" > end > end > > Chad > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Marcello Parra wrote:> But that gives an undefined method `update_page'' error.... > I could not find the problem....<%= render :update => |page| do end %> right? -- Phlip http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Yes..... But I need to call it in after_filter in a Controller.... I doing something wrong.... On 2/12/07, Phlip <phlip2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Marcello Parra wrote: > > > But that gives an undefined method `update_page'' error.... > > I could not find the problem.... > > <%= render :update => |page| do > end > %> > > right? > > -- > Phlip > http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!! > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
If you''re calling it from inside a controller, update_page should work. Are you sure you''re defining it in a controller as an instance method? Chad On 2/12/07, Marcello Parra <parra06-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Thanks Chad, > > But that gives an undefined method `update_page'' error.... > I could not find the problem.... > > > Parra > > > > > > I haven''t tried it but I bet you can do: > > > > def my_after_filter > > response.body << update_page do |page| > > page[''element-id''].replace render :partial => "blah" > > end > > end > > > > Chad > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 2/12/07, Phlip <phlip2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Marcello Parra wrote: > > > But that gives an undefined method `update_page'' error.... > > I could not find the problem.... > > <%= render :update => |page| do > end > %> > > right? >No, that''s not right. Inside a view, you use update_page, not render :update. Internally render :update simply delegates to update_page. Chad --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Chad and all... This is what I''m doing: class TestController < ApplicationController after_filter :setbla def setbla response.body << update_page do |page| page[''element_id''].replace render :partial => "blah" end end def index end end I get the error: undefined method `update_page'' for #<TestController:0x347e408> Where is the mistake ??? Or is there another way to do that ?? Thanks On 2/12/07, Chad Fowler <chad-Vm8wfZGX7qC+XT7JhA+gdA@public.gmane.org> wrote:> > If you''re calling it from inside a controller, update_page should > work. Are you sure you''re defining it in a controller as an instance > method? > > Chad--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Have you found a solution? i''m also struggling with that issue -- 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 -~----------~----~----~----~------~----~------~--~---