pmq20 / mathjax-rails

Simple gem to integrate MathJax with Rails and maintains MathJax at a system-wide directory.
MIT License
66 stars 30 forks source link

undefined method `mathjax_path' in a Rails engine #16

Open dongli opened 9 years ago

dongli commented 9 years ago

When I change the layout of an engine to the one of the application, I got the following error:

ActionView::Template::Error (undefined method `mathjax_path' for #<#<Class:0x007fd2bad1cbf0>:0x007fd2c1cca600>):
    12:       TeX: { equationNumbers: { autoNumber: "all" } }
    13:     });
    14:   </script>
    15:   <%= mathjax_tag %>
    16:   <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
    17:   <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
    18:   <%= csrf_meta_tags %>
  app/views/layouts/application.html.erb:15:in `_app_views_layouts_application_html_erb___3320660116759457037_70271586191680'

and I try to find out mathjax_path, but only found it in mathjax-rails-2.5.1/lib/mathjax/rails/helpers.rb:

module Mathjax
  module Rails
    module ViewHelpers
      def mathjax_tag(opt={})
        opt[:config] ||= 'TeX-AMS_HTML-full.js'
        opt[:config] = nil if opt[:config] == false
        "<script src=\"#{mathjax_path(:uri=>'MathJax.js', config: opt[:config])}\" type=\"text/javascript\"></script>".html_safe
      end 
    end 
  end 
end
ActionView::Base.send :include, Mathjax::Rails::ViewHelpers
dongli commented 9 years ago

I think we need main_app.mathjax_path.