我在让 Paperclip 在我的 VPS 上工作时遇到了一些麻烦。它在本地和我的第一个 VPS 上运行良好,但是当我尝试rake db:migrate
在第二个 VPS 上时,我得到以下输出:
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'
...
到目前为止,我为设置第二个 VPS 所做的是:
- 设置 Unicorn + Nginx(它们似乎工作正常)
apt-get install git
apt-get install imagemagick
bundle install
(回形针在我的 Gemfile 中)- 重新启动我的外壳
- 重启了VPS
毕竟,每当我尝试迁移时,我仍然会收到上述错误。对下一步做什么有任何想法吗?