Skip to content

Commit

Permalink
Merge pull request #627 from ryu39/feature/fix_name_error_mime_js_in_…
Browse files Browse the repository at this point in the history
…rails_510_beta

Fix NameError: uninitialized constant Mime::JS in Rails 5.1.0 beta
  • Loading branch information
unixmonkey authored Mar 13, 2017
2 parents 1d40955 + ed0b864 commit 2b429c7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/wicked_pdf/wicked_pdf_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ def wicked_pdf_image_tag(img, options = {})

def wicked_pdf_javascript_src_tag(jsfile, options = {})
jsfile = WickedPdfHelper.add_extension(jsfile, 'js')
type = ::Mime.respond_to?(:[]) ? ::Mime[:js] : ::Mime::JS # ::Mime[:js] cannot be used in Rails 2.3.
src = "file:///#{WickedPdfHelper.root_path.join('public', 'javascripts', jsfile)}"
content_tag('script', '', { 'type' => Mime::JS, 'src' => path_to_javascript(src) }.merge(options))
content_tag('script', '', { 'type' => type, 'src' => path_to_javascript(src) }.merge(options))
end

def wicked_pdf_javascript_include_tag(*sources)
Expand Down

0 comments on commit 2b429c7

Please sign in to comment.