I''m trying to do this: erb = ERB.new(template) result = erb.result(binding) When I run this I get "Can only render or redirect once per action" and I''m not sure why. I have been digging through the rails source but there is definitely something that I am not understanding. Any ideas? Thanks, Carl. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 8/23/06, Carl Woodward <cjwoodward-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > I''m trying to do this: > > erb = ERB.new(template) > result = erb.result(binding) > > When I run this I get "Can only render or redirect once per action" > and I''m not sure why. I have been digging through the rails source but > there is definitely something that I am not understanding. > > Any ideas?ERB doesn''t set either of the ''performed'' instance variables; without seeing the context, it is hard to tell what the problem might be. But, having been burned by this myself, make sure that you are exiting the action after you call render - doing this if something render thing1 end render thing2 where ''thing2'' is intended as a default action, will get you the DoubleRenderError you''re describing. Adding a return statement after the first render will fix it. The default message for DoubleRenderError is much more informative than the replacement supplied by the render function - check it out for more detail. Hope this helps, -- Matt Jones mdj.acme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org President/Technical Director, Acme Art Company (acmeartco.org) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Guys, I''m sorry that I posted that question. It was quite dumb. I had a render :partial in the template that I was running through ERB. Sorry to bother everyone. Thanks, Carl. On 8/23/06, Matt Jones <mdj.acme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > On 8/23/06, Carl Woodward <cjwoodward-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I''m trying to do this: > > > > erb = ERB.new(template) > > result = erb.result(binding) > > > > When I run this I get "Can only render or redirect once per action" > > and I''m not sure why. I have been digging through the rails source but > > there is definitely something that I am not understanding. > > > > Any ideas? > > > ERB doesn''t set either of the ''performed'' instance variables; without seeing > the > context, it is hard to tell what the problem might be. > > But, having been burned by this myself, make sure that you are exiting the > action after you call render - doing this > > if something > render thing1 > end > render thing2 > > where ''thing2'' is intended as a default action, will get you the > DoubleRenderError > you''re describing. Adding a return statement after the first render will fix > it. > The default message for DoubleRenderError is much more informative than the > replacement supplied by the render function - check it out for more detail. > > Hope this helps, > -- > Matt Jones > mdj.acme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > President/Technical Director, Acme Art Company (acmeartco.org) > > >-- Carl Woodward 0412218979 cjwoodward-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---