I''m trying to render a rails form using HAML outside of the normal Rails flow using the code below: template = File.join("#{Rails.root}", ''lib'', ''templates'') context = ActionView::Base.new(template, {}, @controller, nil) context.class_eval do include Rails.application.routes.url_helpers inlcude Rails.application.routes.mounted_helpers end Haml::Engine.new(template, :attr_wrapper => ''\'').render(context, { :@page => @page }) The problem is I keep receiving the following error undefined method `protect_against_forgery?'' for #<ActionView::Base:0x007fcd05b52fa0> For some reason the helper_methods defined in the controller are not being set on the ActionView::Base instance and I''m not sure how to set them or how Rails goes about doing it. I''ve looked through the source code but don''t see how it is wired together. That said if I manually add the methods using class_eval then it all works the template renders correctly def protect_against_forgery? @controller.send(:protect_against_forgery?) end def form_authenticity_token @controller.send(:form_authenticity_token) end -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/7akt9KHpIIkJ. For more options, visit https://groups.google.com/groups/opt_out.