bootstrap-ruby / middleman-bootstrap-navbar

Middleman extension to easily generate a Bootstrap navbar

Home Page:http://bootstrap-ruby.github.io/middleman-bootstrap-navbar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

undefined method `html_safe'?

xapss opened this issue · comments

Hi there,

Just tried out your gem. Excellent idea.

However, when I try to implement it i get this error: undefined method `html_safe'?

Here's the log. Do you know what I'm doing wrong? Thanks a bunch!

Traceback (innermost first)

/Users/maurice/.rvm/gems/ruby-1.9.3-p327/bundler/gems/middleman-bootstrap-navbar-649c8d947bd4/lib/middleman-bootstrap-navbar/helpers.rb: in block in responsive_button
          (0..2).map do...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/padrino-helpers-0.10.7/lib/padrino-helpers/output_helpers.rb: in call
        captured_html = block_given? && block.call(*args) if captured_html.blank?...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/padrino-helpers-0.10.7/lib/padrino-helpers/output_helpers.rb: in capture_html
        captured_html = block_given? && block.call(*args) if captured_html.blank?...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/padrino-helpers-0.10.7/lib/padrino-helpers/tag_helpers.rb: in content_tag
          content = capture_html(&block)...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/bundler/gems/middleman-bootstrap-navbar-649c8d947bd4/lib/middleman-bootstrap-navbar/helpers.rb: in responsive_button
        content_tag :a, class: 'btn btn-navbar', data: { toggle: 'collapse', target: '.nav-collapse' } do...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/bundler/gems/middleman-bootstrap-navbar-649c8d947bd4/lib/middleman-bootstrap-navbar/helpers.rb: in block (2 levels) in container_div
            parts << responsive_button if responsive...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/bundler/gems/middleman-bootstrap-navbar-649c8d947bd4/lib/middleman-bootstrap-navbar/helpers.rb: in tap
          [].tap do |parts|...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/bundler/gems/middleman-bootstrap-navbar-649c8d947bd4/lib/middleman-bootstrap-navbar/helpers.rb: in block in container_div
          [].tap do |parts|...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/padrino-helpers-0.10.7/lib/padrino-helpers/output_helpers.rb: in call
        captured_html = block_given? && block.call(*args) if captured_html.blank?...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/padrino-helpers-0.10.7/lib/padrino-helpers/output_helpers.rb: in capture_html
        captured_html = block_given? && block.call(*args) if captured_html.blank?...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/padrino-helpers-0.10.7/lib/padrino-helpers/tag_helpers.rb: in content_tag
          content = capture_html(&block)...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/bundler/gems/middleman-bootstrap-navbar-649c8d947bd4/lib/middleman-bootstrap-navbar/helpers.rb: in container_div
        content_tag :div, class: fluid ? 'container-fluid' : 'container' do...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/bundler/gems/middleman-bootstrap-navbar-649c8d947bd4/lib/middleman-bootstrap-navbar/helpers.rb: in block (2 levels) in nav_bar
            container_div options[:brand], options[:brand_link], options[:responsive], options[:fluid], &block...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/padrino-helpers-0.10.7/lib/padrino-helpers/output_helpers.rb: in call
        captured_html = block_given? && block.call(*args) if captured_html.blank?...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/padrino-helpers-0.10.7/lib/padrino-helpers/output_helpers.rb: in capture_html
        captured_html = block_given? && block.call(*args) if captured_html.blank?...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/padrino-helpers-0.10.7/lib/padrino-helpers/tag_helpers.rb: in content_tag
          content = capture_html(&block)...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/bundler/gems/middleman-bootstrap-navbar-649c8d947bd4/lib/middleman-bootstrap-navbar/helpers.rb: in navbar_inner_div
        content_tag :div, class: 'navbar-inner', &block...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/bundler/gems/middleman-bootstrap-navbar-649c8d947bd4/lib/middleman-bootstrap-navbar/helpers.rb: in block in nav_bar
          navbar_inner_div do...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/padrino-helpers-0.10.7/lib/padrino-helpers/output_helpers.rb: in call
        captured_html = block_given? && block.call(*args) if captured_html.blank?...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/padrino-helpers-0.10.7/lib/padrino-helpers/output_helpers.rb: in capture_html
        captured_html = block_given? && block.call(*args) if captured_html.blank?...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/padrino-helpers-0.10.7/lib/padrino-helpers/tag_helpers.rb: in content_tag
          content = capture_html(&block)...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/bundler/gems/middleman-bootstrap-navbar-649c8d947bd4/lib/middleman-bootstrap-navbar/helpers.rb: in nav_bar_div
        content_tag :div, class: css_class, &block...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/bundler/gems/middleman-bootstrap-navbar-649c8d947bd4/lib/middleman-bootstrap-navbar/helpers.rb: in nav_bar
        nav_bar_div options do...
/Users/maurice/Documents/html/Studentify/dev/yippie_homepage/source/layouts/layout.haml: in block in singletonclass
              = nav_bar fixed: :top, brand: "My great app", responsive: true do...
/Users/maurice/Documents/html/Studentify/dev/yippie_homepage/source/layouts/layout.haml: in instance_eval
/Users/maurice/Documents/html/Studentify/dev/yippie_homepage/source/layouts/layout.haml: in singletonclass
/Users/maurice/Documents/html/Studentify/dev/yippie_homepage/source/layouts/layout.haml: in __tilt_70277434394680
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/tilt-1.3.7/lib/tilt/template.rb: in call
      method.bind(scope).call(locals, &block)...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/tilt-1.3.7/lib/tilt/template.rb: in evaluate
      method.bind(scope).call(locals, &block)...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/tilt-1.3.7/lib/tilt/haml.rb: in evaluate
        super...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/tilt-1.3.7/lib/tilt/template.rb: in render
      evaluate scope, locals || {}, &block...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/middleman-core-3.0.14/lib/middleman-core/core_extensions/rendering.rb: in render_individual_file
          content = template.render(context, locs, &block)...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/middleman-core-3.0.14/lib/middleman-core/core_extensions/rendering.rb: in render_template
            content = render_individual_file(layout_path, locs, opts, context) { content }...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/middleman-core-3.0.14/lib/middleman-core/sitemap/resource.rb: in block in render
          app.render_template(source_file, locs, opts, blocks)...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.13/lib/active_support/notifications.rb: in instrument
          yield payload if block_given?...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/middleman-core-3.0.14/lib/middleman-core/util.rb: in instrument
      ::ActiveSupport::Notifications.instrument(name, payload, &block)...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/middleman-core-3.0.14/lib/middleman-core/application.rb: in instrument
    delegate :logger, :instrument, :to => ::Middleman::Util...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/middleman-core-3.0.14/lib/middleman-core/sitemap/resource.rb: in instrument
      delegate :logger, :instrument, :to => :app...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/middleman-core-3.0.14/lib/middleman-core/sitemap/resource.rb: in render
        instrument "render.resource", :path => relative_source  do...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/middleman-core-3.0.14/lib/middleman-core/core_extensions/request.rb: in process_request
            output = resource.render do...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/middleman-core-3.0.14/lib/middleman-core/core_extensions/request.rb: in block in call!
            process_request(env, req, res)...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/middleman-core-3.0.14/lib/middleman-core/core_extensions/request.rb: in catch
          catch(:halt) do...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/middleman-core-3.0.14/lib/middleman-core/core_extensions/request.rb: in call!
          catch(:halt) do...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/middleman-core-3.0.14/lib/middleman-core/core_extensions/request.rb: in call
          dup.call!(env)...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.5/lib/rack/builder.rb: in call
      to_app.call(env)...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.5/lib/rack/urlmap.rb: in block in call
        return app.call(env)...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.5/lib/rack/urlmap.rb: in each
      @mapping.each do |host, location, match, app|...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.5/lib/rack/urlmap.rb: in call
      @mapping.each do |host, location, match, app|...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.5/lib/rack/showexceptions.rb: in call
      @app.call(env)...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.5/lib/rack/builder.rb: in call
      to_app.call(env)...
/Users/maurice/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.5/lib/rack/handler/webrick.rb: in service
        status, headers, body = @app.call(env)...
/Users/maurice/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/webrick/httpserver.rb: in service
      si.service(req, res)...
/Users/maurice/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/webrick/httpserver.rb: in run
          server.service(req, res)...
/Users/maurice/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/webrick/server.rb: in block in start_thread
          block ? block.call(sock) : run(sock)

The problem is that I don't know whether/when to rely on the Padrino helpers (like html_safe) to be available...
However, I am working on a rewrite that will use a separate gem to generate the HTML (see https://github.com/krautcomputing/bootstrap_navbar/blob/master/lib/bootstrap_navbar/helpers.rb), that should solve the issue.