Ruby on Rails problems & solutions, Dec 9, 2010

December 10, 2010

responds_to_parent for Rails 3

This is the linchpin of the solution to Ajaxified file uploads, from my Dec 8 posting.

And over to the Rails 3 project, and ….too bad it doesn’t work on the Rails 3 project (aaaarrrrrgggghhhh)

But, wait, here’s one (subtly different name) that does work…


respond_to_parent with jQuery

Seriously.  All the examples are Prototype.  All of ‘em.  I did a lot of Googling, and didn’t really find an answer.  So after a lot of trial and error, I came up with this one:

      format.js do 

        respond_to_parent do

          render :action => ‘your_action.js.erb name here’



Capistrano and Paperclip uploads

But, but, I don’t want my precious Excel files flapping out there in the wind (under public).

This link describes, in detail, how to update your attachments’ url and path configuration, including how to get them out of public:

Although the following link still throws stuff under public, you can change those locations to the ones you selected above.  And it includes the Capistrano tasks for managing your uploads dir, including multistage support.  Priceless time saver.