Skip to content

Instantly share code, notes, and snippets.

@bhaskarkotu
Created April 9, 2014 08:12
Show Gist options
  • Save bhaskarkotu/10239855 to your computer and use it in GitHub Desktop.
Save bhaskarkotu/10239855 to your computer and use it in GitHub Desktop.
def generatereport
if !params[:id].blank? && Report.find(params[:id])
respond_to do |format|
format.pdf do
render :pdf => "file_name",
:orientation => 'Portrait'
end
format.html
end
else
result['status'] &= false
result['error_messages'].push('Report does not exist with id '+ params[:id].to_s )
end
end
@bhaskarkotu
Copy link
Author

http://localhost:3000/reports/1/generatereport path is showing up plain html file, where as http://localhost:3000/reports/1/generatereport.pdf saying missing template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment