I get this error when I try to submit my form (it is assumed that the PDF will be created using the Wicked PDF gem when submitting the form) -
NameError in PostsController
How to fix it? The corresponding code is below.
POSTS CONTROLLER
def create @post = Post.new(params[:post]) @post.user = current_user respond_to do |format| if verify_recaptcha && @post.save format.html { redirect_to :action=> "index"} format.pdf do render :pdf => "file_name" end else format.html { render :action => "new" } format.json { render :json => @post.errors, :status => :unprocessable_entity } end end end
CONFIG / initializers / WICKED_PDF.RB
# config/initializers/wicked_pdf.rb WickedPdf.config = { :exe_path => '/usr/local/bin/wkhtmltopdf' }
Thanks,
Faisal
ruby-on-rails ruby-on-rails-3 wicked-pdf
hikmatyar
source share