On Oct 29, 2010, at 2:03 PM, David Kahn wrote:

Why is Rails looking for a template while I have told it to render a specific file? This worked under Rails 2. I read http://www.engineyard.com/blog/2010/render-options-in-rails-3/ which from I gather makes any format.xxx look for a template xxx which is *not* what I need to do as the file is created dynamically:

In my controller:

pdf_file_path = "./directory/file_name.pdf" # just an example, assume this file exists
    respond_to do |format|
      format.pdf { render :file => pdf_file_path }
   end

But I get:

ActionView::MissingTemplate (Missing template comparisons/display with {:handlers = > [:erb , :rjs , :builder, :rhtml, :rxml], :formats=>[:pdf], :locale=>[:en, :en]} in view paths "/Users/DK/Documents/ror/projects/creditcompare3/app/ views"):

Is there a way / better way to do this?

I think that you're looking for either send_file or send_data depending on how you create the PDF. If there actually is a file, then send_file will be what you want. If you still have the data in memory, then send_data(stuff) is similar to render(:text => stuff)

-Rob

Rob Biedenharn          
r...@agileconsultingllc.com     http://AgileConsultingLLC.com/
r...@gaslightsoftware.com               http://GaslightSoftware.com/

--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to