Assistance using respond_to to find the right actions to render PDF in ruby on rails

Posted by Angela on Stack Overflow See other posts from Stack Overflow or by Angela
Published on 2010-05-05T01:47:26Z Indexed on 2010/05/05 1:58 UTC
Read the original article Hit count: 360

Hi, I am trying out Prince with the Princely plugin, which is supposed to format templates that have the .pdf into a PDF generator.

Here is my controller:

class TodoController < ApplicationController

  def show_date
    @date = Date.today

    @campaigns = Campaign.all

    @contacts = Contact.all

    @contacts.each do |contact|

    end

    respond_to do |format|
      format.html
      format.pdf do
        render :pdf => "filename", :stylesheets => ["application", "prince"], :layout => "pdf"
      end
    end
  end

end

I changed the routes.db to include the following:

map.connect ':controller/:action.:format'

  map.todo "todo/today",
            :controller => "todo",
            :action => "show_date"

My expected behavior is when I enter todo/today.pdf, it tries to execute show_date, but renders according to the princely plugin.

Right now, it says cannot find action. What do I need to do to fix this?

© Stack Overflow or respective owner

Related posts about princely

Related posts about pdf