Hi! I’m using the wicked_pdf and I have a problem. The css don’t work. How use correctly?
My code is this:
application.html.erb
WickedPdfExample<%= wicked_pdf_stylesheet_link_tag “bootstrap.min.css” -%>
<%= wicked_pdf_stylesheet_link_tag “application.css” -%>
<%= stylesheet_link_tag ‘application’, media: ‘all’, ‘data-turbolinks-track’ => true %>
<%= javascript_include_tag ‘application’, ‘data-turbolinks-track’ => true %>
<%= csrf_meta_tags %>
<%= yield %>
customers_controller.erb
def index
@customers = Customer.all
respond_to do |format|
format.html
format.pdf do
render :pdf => ‘file_name’,
:template => ‘customers/index.pdf.erb’,
:show_as_html => params[:debug].present?
end
end
end
index.pdf.erb
Listing Customers
<% @customers.each do |customer| %>
<% end %>
Name | Cpf | Occupation |
---|---|---|
<%= customer.name %> | <%= customer.cpf %> | <%= customer.occupation %> |
And sometimes, get this error:
undefined method `start_with?' for nil:NilClass
What I 'm making wrong?