Using Prawn in Rails 2.3.5

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.

Ok, I had a lot of issues with this too, so I will just put all the steps I used to get it to work.

#SETUP #though I'm sure bundler would be better for this Installed Prawn gem config.gem 'prawn', :version => '0.6.3'

Installed Prawnto plugin ./script/plugin install git://github.com/thorny-sun/prawnto.git

#Routes map.with_options(:controller => 'admin/reports') do |m| m.admin_marketing_report 'admin/marketing', :controller => 'admin/reports', :action => 'marketing' end

#Controller class Admin::ReportsController < AdminController   def marketing     respond_to do |format|       format.pdf do         @advertisements = Advertisement.all       end     end   end end

#VIEW /admin/reports/marketing.prf.prawn pdf.text "Marketing Report", :size => 18, :style => :bold

Hopefully this will help you out.

~Jeremy