Hey all, how can i render :partial and render :text in one action? I need to update the partial and update an div field with some html data. Thanks for your help :) -- 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 Sep 14, 11:02 pm, Stephan Meier <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hey all, > > how can i render :partial and render :text in one action? > > I need to update the partial and update an div field with some html > data. > > Thanks for your help :) > -- > Posted viahttp://www.ruby-forum.com/.How about you use render :update instead? --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> How about you use render :update instead?But how to call the partials? render :update |page| page.xxxx partials...? end -- 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 -~----------~----~----~----~------~----~------~--~---
Stephan Meier wrote:>> How about you use render :update instead? > > But how to call the partials? > > render :update |page| > > page.xxxx partials...? > > endActually... what you are trying to do doesn''t seem to be possible this way. You can only call render ONCE IN A CONTROLLER per request. To clear things up a little, what exaclty is your situation? a) You have a page rendered in the browser and you want to replace a part of it with a partial and some other part with a text via ajax? Then you can use: render :update do |page| page[:name_of_part].replace_html :partial => :name_of_partial page[:name_of_other_part].replace_html "New Text" end render :update (in this case) sends a javascript back to your browser, which updates the elements given by page[:element_id]. b) You have a normal request and you want to render multiple things from your controller? Not possbile this way. You can call render as many time as you want in a view, but only once per action in a controller. So you have to redesign this part of your app. Hope this helps. Mike -- 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''m not 100% sure what you''re doing, but look at render_to_string. On Sep 14, 4:21 pm, Mike Zaschka <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Stephan Meier wrote: > >> How about you use render :update instead? > > > But how to call the partials? > > > render :update |page| > > > page.xxxx partials...? > > > end > > Actually... what you are trying to do doesn''t seem to be possible this > way. You can only call render ONCE IN A CONTROLLER per request. To clear > things up a little, what exaclty is your situation? > > a) You have a page rendered in the browser and you want to replace a > part of it with a partial and some other part with a text via ajax? > > Then you can use: > > render :update do |page| > page[:name_of_part].replace_html :partial => :name_of_partial > page[:name_of_other_part].replace_html "New Text" > end > > render :update (in this case) sends a javascript back to your browser, > which updates the elements given by page[:element_id]. > > b) You have a normal request and you want to render multiple things from > your controller? > > Not possbile this way. You can call render as many time as you want in a > view, but only once per action in a controller. So you have to redesign > this part of your app. > > Hope this helps. > > Mike > > -- > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---