How do you declare a Rake task that depends on a parameterized task?

Args are passed down through the call stack. You just need to make sure your top-level task captures all the arguments all of the dependencies require. In your case you’ll want to put first_name and last_name on the send_letter task. Here is an example that shows named arguments defined elsewhere flowing into the dependency (even … Read more

Seeding file uploads with CarrierWave, Rails 3

Turns out the documentation for CarrierWave is slightly wrong. There is a more up to date piece of code in the README at the GitHub repository for the project. In a nutshell, though: pi = ProductImage.create!(:product => product) pi.image.store!(File.open(File.join(Rails.root, ‘test.jpg’))) product.product_images << pi product.save!

Force Rake Task To Run in Specific Rails Environment

I’ve accomplished this kind of this before, albeit not in the most elegant of ways: task :prepare do system(“bundle exec rake … RAILS_ENV=development”) system(“bundle exec rake … RAILS_ENV=development”) system(“bundle exec rake … RAILS_ENV=test”) system(“bundle exec rake … RAILS_ENV=test”) system(“bundle exec rake … RAILS_ENV=test”) system(“bundle exec rake … RAILS_ENV=test”) end It’s always worked for me. I’d … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)