Topic: redirect back generically?
My app allows users to upload images. These images end up in different parts of their profile and show up in many different places throughout my website. Whenever a user uploaded image is displayed, it's wrapped in a "report_abuse" partial that includes a tiny link just below the image where people can click if the image is offensive.
Clicking the 'report abuse' link is just this
<%= link_to 'report this image', :controller => 'image', :action => 'report_abuse', :id => image %>
and the action is something like this
abuse = ImageAbuse.new(:image_id => params[:id])
flash[:notice] = 'the image has been reported for abuse'
# this is obviously not a real method
How can I implement 'redirect_to_wherever_the_heck_they_where_when_they_clicked'? Is it possible to do so generically? Can rails say look at the "request stack" or something like that? I REALLY don't want to have to include a parameter in the call to tell report_abuse where to return to.
I could do this particular example with AJAX (and may just do that), but in general, I'd like to know how to do this or know that it's generally not possible.
oh, and acts_as_authenticated has "redirect_back_or_default", but it doesn't seem to work.
Last edited by tortoise (2006-12-29 10:37:48)