Reputation: 696
I'm having some trouble getting Paperclip working on my VPS. It works fine locally and on my first VPS, but when I try to rake db:migrate
on the second VPS, I get the following output:
root@Test:/home/rails# rake db:migrate
== CreateGroups: migrating ===================================================
-- create_table(:groups)
-> 0.0019s
-- add_column(:discussions, :group_id, :integer)
-> 0.0007s
-- add_column(:memberships, :memberships_id, :integer)
-> 0.0006s
-- has_attached_file(:photo, {:styles=>{:original=>"400x200>", :tile=>"200x200#"}, :url=>"/assets/images/groups/:id/:style/:basename.:extension", :path=>":rails_root/public/assets/images/groups/:id/:style/:basename.:extension", :default_url=>"/assets/:style/missing-group-image.jpg"})
rake aborted!
An error has occurred, this and all later migrations canceled:
undefined method `has_attached_file' for #<CreateGroups:0x0000000342cbf8>/usr/local/rvm/gems/ruby-1.9.3-p429/gems/activerecord-3.2.8/lib/active_record/migration.rb:465:in `block in method_missing'
...
What I've done so far to set up this second VPS is:
apt-get install git
apt-get install imagemagick
bundle install
(and Paperclip is in my Gemfile)After all of this, I'm still getting the above error whenever I try to migrate. Any ideas of what to do next?
Upvotes: 0
Views: 1909
Reputation: 696
It turns out that my issue had more to do with incomplete code than my environment. Turns out that a teammate of mine had pushed some incomplete code to our GitHub repository, and I hadn't noticed it.
By doing git logs
, choosing the right commit, and then git checkout (...)
, I was able to migrate and seed my database and run my application as expected.
I feel very silly for spending over an hour trying to figure that out, but hopefully it helps someone else. :)
Upvotes: 0
Reputation: 10593
I think you didn't quite follow Paperclip installation guide. You should have following migration (copied from Paperclip readme so may slightly differ for you)
class AddAvatarColumnsToUsers < ActiveRecord::Migration
def self.up
add_attachment :users, :avatar
end
def self.down
remove_attachment :users, :avatar
end
end
and you apparently put there something that should be in you MODEL.
Upvotes: 1