I''m trying to print a report as a pdf, which uses the render method.
This works fine. The problem comes at the end when I try to redirect
to the index page, which causes the double render. I''m sure
there''s a
way around this, but I''m coming up blank. If I remember right, there
was a method that acted almost like redirect_to, but wouldn''t cause
the error. Please help...
                            Thanks
                                  Bob
-- 
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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
How come you want to present the report and then close it and go somewhere else? people wont see it. i dont get it , it seems you used render where you should have used send_file but i need to see your code to be sure. -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
When I render the report, it''s to a file that can be viewed, printed,
or backed up as needed. It is to a pdf, so I''m using:
        respond_to do |format|
          format.pdf { send_data render_to_pdf( :action =>
''idreport'',
                                                :layout =>
''pdf_report''),
                                                :filename => "ID List
for " + @today.strftime(''%m-%d-%y'') + ".pdf" }
        end
  Then the error is caused by a redirect_to(households_url)
Bob
On Jun 6, 3:19 pm, radhames brito
<rbri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> How come you want to present the report and then close it and go somewhere
> else? people wont see it. i dont get it , it seems you used render where
you
> should have used send_file but i need to see your code to be sure.
-- 
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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jun 6, 8:10 pm, Bob Smith <bsm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m trying to print a report as a pdf, which uses the render method. > This works fine. The problem comes at the end when I try to redirect > to the index page, which causes the double render. I''m sure there''s a > way around this, but I''m coming up blank. If I remember right, there > was a method that acted almost like redirect_to, but wouldn''t cause > the error. Please help... >I don''t think you do - there can only be a single response to an http request, so you can''t both provide a file and show a response (unless perhaps you were to do something like have your "success" page include an iframe with the actual download) Fred Fred> Thanks > > Bob-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mon, Jun 6, 2011 at 3:41 PM, Bob Smith <bsm2th-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> When I render the report, it''s to a file that can be viewed, printed, > or backed up as needed. It is to a pdf, so I''m using: > >That i understand , you can render the file inline or send it to the user, what i dont understand is the need to redirect after that. Please explain. But be aware that you cant double render, it will always raise an exception. -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
The reason for the redirect_to is to end the process after the file is created at the index page so the user doesn''t have to find his way back. Is there a way to go to the start or index page maybe? Bob On Jun 7, 12:03 am, radhames brito <rbri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mon, Jun 6, 2011 at 3:41 PM, Bob Smith <bsm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > When I render the report, it''s to a file that can be viewed, printed, > > or backed up as needed. It is to a pdf, so I''m using: > > That i understand , you can render the file inline or send it to the user, > what i dont understand is the need to redirect after that. Please explain. > But be aware that you cant double render, it will always raise an exception.-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.