如何解决ruby-on-rails-4中rails 4 wicked pdf模板缺失问题?
- 内容介绍
- 文章标签
- 相关推荐
本文共计326个文字,预计阅读时间需要2分钟。
我已经使用wicked_pdf gem将HTML转换为PDF生成在Rails 4中。它不起作用,会在/events/calendar_month_print.pdf中抛出类似ActionView::MissingTemplate的错误,缺少模板事件/calendar_month_print..erb,其中包含缺少模板的错误。
我已经使用wicked pdf gem for html to pdf generate in rails 4.它对我不起作用,它会在/events/calendar_month_print.pdf中抛出类似ActionView :: MissingTemplate的错误缺少模板事件/ calendar_month_print.html.erb,其中包含{:locale => [:en],:formats => [:pdf],:variants => [],:handlers => [:erb,:builder ,:raw,: ruby,:rabl,:rxls,:“xls.rxls”,:jbuilder]}.搜索:我也在我的应用程序中创建了calendar_month_print.html.erb文件.我不知道我在哪里丢失.
我的宝石文件
gem 'wicked_pdf' gem 'wkhtmltopdf-binary'
我的Controller文件
respond_to do |format| format.html format.pdf do render :pdf => "monthly_events.pdf",:template => "events/calendar_month_print.html.erb" end end
我的视图文件
<%= button_to "Print as pdf", calendar_month_print_events_path(format: "pdf"), :class => "btn btn-primary button monthly_print pull-right",:method => :get,target: '_blank' %>
我的config / initializers / mime_types.rb
Mime::Type.register "application/pdf", :pdf
我的config / initializers / wicked_pdf.rb
WickedPdf.config = { #:wkhtmltopdf => '/usr/local/bin/wkhtmltopdf', #:layout => "pdf.html", :exe_path => '/usr/local/bin/wkhtmltopdf' } 当你给渲染时:pdf => “monthly_events.pdf”,:template => “events / calendar_month_print.html.erb”,Rails在app / views / events中需要一个名为calendar_month_print.html.erb的文件.如果您将其放置在其他位置,则将其移至app / views / events
本文共计326个文字,预计阅读时间需要2分钟。
我已经使用wicked_pdf gem将HTML转换为PDF生成在Rails 4中。它不起作用,会在/events/calendar_month_print.pdf中抛出类似ActionView::MissingTemplate的错误,缺少模板事件/calendar_month_print..erb,其中包含缺少模板的错误。
我已经使用wicked pdf gem for html to pdf generate in rails 4.它对我不起作用,它会在/events/calendar_month_print.pdf中抛出类似ActionView :: MissingTemplate的错误缺少模板事件/ calendar_month_print.html.erb,其中包含{:locale => [:en],:formats => [:pdf],:variants => [],:handlers => [:erb,:builder ,:raw,: ruby,:rabl,:rxls,:“xls.rxls”,:jbuilder]}.搜索:我也在我的应用程序中创建了calendar_month_print.html.erb文件.我不知道我在哪里丢失.
我的宝石文件
gem 'wicked_pdf' gem 'wkhtmltopdf-binary'
我的Controller文件
respond_to do |format| format.html format.pdf do render :pdf => "monthly_events.pdf",:template => "events/calendar_month_print.html.erb" end end
我的视图文件
<%= button_to "Print as pdf", calendar_month_print_events_path(format: "pdf"), :class => "btn btn-primary button monthly_print pull-right",:method => :get,target: '_blank' %>
我的config / initializers / mime_types.rb
Mime::Type.register "application/pdf", :pdf
我的config / initializers / wicked_pdf.rb
WickedPdf.config = { #:wkhtmltopdf => '/usr/local/bin/wkhtmltopdf', #:layout => "pdf.html", :exe_path => '/usr/local/bin/wkhtmltopdf' } 当你给渲染时:pdf => “monthly_events.pdf”,:template => “events / calendar_month_print.html.erb”,Rails在app / views / events中需要一个名为calendar_month_print.html.erb的文件.如果您将其放置在其他位置,则将其移至app / views / events

