Hobo Cookbook

View Source

Question: Question A bug in dryml ?

Asks Yannick Chevalier
Hi,I am a hobo newbie, so perhaps I am missing something.For some reasons I have to call directly Dryml.render.However it breaks on the <br> tag, e.g. (in any rails console):1.9.3p194 :008 > str="<p>a paragraph</p>".html_safe => "<p>a paragraph</p>" 1.9.3p194 :009 > Dryml.render str, :this => nil => "<p>a paragraph</p>" 1.9.3p194 :010 > str="<br /><p>a paragraph</p>".html_safe => "<br /><p>a paragraph</p>" 1.9.3p194 :011 > Dryml.render str, :this => nilNoMethodError: undefined method `br' for #<ActionView::Base:0x00000002db5220> from ~/.rvm/gems/ruby-1.9.3-p194@hobo2/gems/dryml-1.4.0.pre6/lib/dryml/template_environment.rb:635:in `method_missing' from <br /><p>a paragraph</p>:1:in `block in render_page' from ~/.rvm/gems/ruby-1.9.3-p194@hobo2/gems/dryml-1.4.0.pre6/lib/dryml/template_environment.rb:318:in `block in new_object_context' from ~/.rvm/gems/ruby-1.9.3-p194@hobo2/gems/dryml-1.4.0.pre6/lib/dryml/template_environment.rb:281:in `block in new_context' from ~/.rvm/gems/ruby-1.9.3-p194@hobo2/gems/actionpack-3.1.6/lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer' from ~/.rvm/gems/ruby-1.9.3-p194@hobo2/gems/dryml-1.4.0.pre6/lib/dryml/template_environment.rb:281:in `new_context' from ~/.rvm/gems/ruby-1.9.3-p194@hobo2/gems/dryml-1.4.0.pre6/lib/dryml/template_environment.rb:295:in `new_object_context' from <br /><p>a paragraph</p>:1:in `render_page' from /home/ychevali/.rvm/gems/ruby-1.9.3-p194@hobo2/gems/dryml-1.4.0.pre6/lib/dryml.rb:189:in `render' from (irb):11 from ~/.rvm/gems/ruby-1.9.3-p194@hobo2/gems/railties-3.1.6/lib/rails/commands/console.rb:45:in `start' from ~/.rvm/gems/ruby-1.9.3-p194@hobo2/gems/railties-3.1.6/lib/rails/commands/console.rb:8:in `start' from ~/.rvm/gems/ruby-1.9.3-p194@hobo2/gems/railties-3.1.6/lib/rails/commands.rb:40:in `<top (required)>' from script/rails:6:in `require' from script/rails:6:in `<main>'I have just downloaded the latest hobo and dryml gems, and would like to know whether this is a bug or a miscomprehension before delving into the codeThanks in advance

Discussion

  • In answer to A bug in dryml ?
    Bryan Larsen Says:
    This sort of thing is better discussed on the hobo users mailing list where it's easier to go back and forth.

    That said, I'd first want to attack why you feel you have to call Dryml.render directly.

    br is defined in hobo_rapid/taglibs/html/empty_tag.dryml, so that is not getting included into your app somehow.

    To overcome your specific problem, you can add br to RAILS_ROOT/config/dryml_static_tags.txt or you can def a br tag similar to the one in empty_tag.dryml.