Hi
I’m a big fan of Railscasts as I’ve been using them to further my
learning in Ruby on Rails. I’m a student at Carnegie Mellon University
and I’m having a problem with a gem that I have to use for my class
project. I had followed a tutorial for using Prawn from RailsCasts,
and I followed each and every step from setup to testing it as shown
in the video.
However, when I implemented it, I first got an error ‘unitialized
constant Mime::PDF’. I fixed it by adding ‘Mime::Type.register_alias
"application/pdf’ in /config/initializers/mime_types.rb of my project.
FYI, my current project started off as a scaffold. I also created a
sample .pdf.prawn file with “pdf.text ‘Sample PDF output’”. Now I get
the following error:
All my routes are pluralized and I’m testing this out on ‘index’.
Following is the scaffolded code with the extra line that is supposed
to render the pdf:
def index
@administrators = Administrator.all
respond_to do |format|
format.html # index.html.erb
format.xml {render :xml => @administrators }
format.pdf {render :layout => false}
end
end
///////
As for the error that takes place when I do
http://127.0.0.1:3001/administrator.pdf:
“Routing Error
No route matches “/administrator” with {:method=>:get}”
when I do http://127.0.0.1:3001/administrators.pdf, I get the
following:
“Template is missing
Missing template administrators/index.erb in view path app/views”
//////
Just some info: I have Rails 2.3.5, and doing my development on Aptana
RadRails as it has worked for me before. This is all taking place in
Windows XP.
I will appreciate any help to resolve this. Even a step by step
tutorial that starts afresh.