The reason this is failing is that the context object you're passing to Haml doesn't have the helpers you're trying to use defined. The point of a context object is to have the methods you want to make available to the template.
On Wed, Jul 29, 2009 at 7:45 AM, JoshL <[email protected]> wrote: > > Hi, > > I am trying something simple, such as this: > > Haml::Engine.new("%h1= pluralize(23,'event')").def_method > (obj, :render) > obj.render > > But when I do, I get this: > > undefined method `pluralize' for #<SandboxController:0x3c50e4c> > > Application Trace | Framework Trace | Full Trace > > (haml):1:in `render' > /Users/jlippiner/Projects/Wripple/app/controllers/ > sandbox_controller.rb:43:in `weekly_report' > /Library/Ruby/Gems/1.8/gems/haml-2.2.0/lib/sass/plugin/rails.rb:19:in > `process_without_compass' > /Library/Ruby/Gems/1.8/gems/chriseppstein-compass-0.8.4/lib/compass/ > app_integration/rails/action_controller.rb:7:in `process' > > > Any thoughts? This works fine, btw, if I view the same code in a haml > file within a view, but I need to render it within a controller for my > app. > > Thanks, > > /Josh > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/haml?hl=en -~----------~----~----~----~------~----~------~--~---
