Migration Issue caused Heroku to fail.
I have an application on Heroku that uses the Paperclip gem that recently had some issues - and I'm not 100% sure on what it was that caused it. I have the application working locally (including the image upload) - but I get an 'Application Error' page on the heroku url, and when I try to access the heroku console with heroku run rails c
it gets an error of:
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/dynamic_matchers.rb:26:in 'method_missing': undefined method '_image_post_process_callbacks' for #<Class:0x007f8aaf5d2fa0> (NoMethodError)
A little background on the issue - another developer was working on creating an image upload model - which was named 'Images' - which I think caused problems with Paperclip, and wouldn't allow me to run a Rails migration. When I tried it said there was an issue with the 'Images' table, so after finding a similar situation online, I commented out the body of the 'def change' within the create_images migration - which now looks like so:
class CreateImages < ActiveRecord::Migration
def change
# create_table :images do |t|
# t.attachment :file
# end
end
end
I then ran another migration - started my server locally and everything was working. I then pushed my changes to heroku, did a rake db:migrate for good luck - and the heroku url is still showing 'Application Error'
If anyone has any idea of possible causes of these issues, it would be greatly appreciated! Thanks for reading!
Hmm, that's interesting. I don't actually use Paperclip myself, but I did google that error and find this: http://stackoverflow.com/questions/4528287/paperclip-callbacks-or-simple-processor
Possibly that's the issue you're running into? Sounds like it has something to do with the callbacks defined on the model.
oh this error is the position of the paperclip method you need to have the has_attachment before the validation.