ruby on rails - Rails4: Template is missing error with using PDFKit -


i'd generate pdf file, trying use pdfkit failing.

the following error displayed when input http://localhost:3000/users/1.pdf browser.

template missing missing template /users.show {:locale=>[:en], :formats=>[:pdf], :variants=>>[], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}. searched in: * "c:/xxx/xxx/app/views"

please advise me on how avoid error.

\config\initializers\pdfkit.rb

pdfkit.configure |config|   config.wkhtmltopdf = `which wkhtmltopdf`.to_s.strip   config.default_options = {     encoding:                "utf-8",     page_size:               "a4"   } end 

\app\controllers\users_controller.rb

  def show     @user = user.find(params[:id])      respond_to |format|         format.html          format.pdf             html = render_to_string template: "users.show"             pdf = pdfkit.new(html, encoding: "utf-8")              send_data pdf.to_pdf,                 filename: "#{@user.id}.pdf",                 type: "application/pdf",                 disposition: "inline"         end     end   end 

\views\users\show.pdf.erb

  <div class="row">     <div class="col-md-5" style="background:orange;"><%= @user.id %></div>     <div class="col-md-7" style="background:yellow;"><%= @user.name %></div>   </div> 

i use bootstrap @import "bootstrap"; in custom.css.scss. error?

\assets\stylesheets\custom.css.scss

@import "bootstrap"; 

my environment windows


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -