Hi! I''m creating a content management system and the standard rails layout/ template/partial approach wasn''t going to cut it for me. I''m now rendering erb templates myself like so: template = ERB.new(File.new("#{RAILS_ROOT}/app/views/content/regular/ #{self.class.to_s.downcase}.html.erb").readline(nil)) edit_template.result(erb_binding {template.result(erb_binding {| symbol| yield_content symbol} )}) The problem this presents is the unavailability of all the standard helper methods like for prototype and for creating tags. I can include all the helpers but I still get method missing errors: include ActionView::Helpers::JavaScriptHelper include ActionView::Helpers::ScriptaculousHelper include ActionView::Helpers::PrototypeHelper include ActionView::Helpers::UrlHelper include ActionView::Helpers::TagHelper gets me: undefined method `protect_against_forgery?'' for #<Section:0x19dad04> Is there any better way to get the full rails view rendering context when handling erb manually? Regards, Stefan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Carsten Gehling
2008-May-07 12:03 UTC
Re: How to get normal view context when using ERB directly
Stefan wrote:> Hi! > > I''m creating a content management system and the standard rails layout/ > template/partial approach wasn''t going to cut it for me. I''m now > rendering erb templates myself like so:I cannot answer your specific question, but could elaborate a bit about why Rails'' approach isn''t good enough for your purpose? Maybe the answer lies a different way. - Carsten -- 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 -~----------~----~----~----~------~----~------~--~---