Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NameError: uninitialized constant Mime::JS in Rails 5.1.0 beta #627

Merged
merged 1 commit into from
Mar 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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