使用heroku和paperclip的回形针,迁移失败

时间:2013-12-02 14:40:38

标签: ruby-on-rails ruby heroku ffmpeg paperclip

我在rails应用程序上创建了一个ruby,我正在使用paperclip来处理我的文件上传。 Paperclip在我的本地机器上工作得很好。但是当我部署到Heroku时,我的视频上传停止了。有谁知道什么是错的。当我尝试上传视频文件名不存在时,我也会收到错误消息。照片上传有效,但不是视频,我使用了回形针嵌套属性和ffmpeg。

上传错误日志

Paperclip::Error (Asset model missing required attr_accessor for 'video_file_name')
2013-12-02T14:38:16.867747+00:00 app[web.1]: Paperclip::Error (Asset model missing required attr_accessor for 'video_file_name'):
2013-12-02T14:38:16.867747+00:00 app[web.1]:   app/controllers/projects_controller.rb:60:in `block in update'
2013-12-02T14:38:16.867747+00:00 app[web.1]:   app/controllers/projects_controller.rb:59:in `update'

以下是我的迁移错误:

Migrating to AddAttachmentPhotoToAssets (20131021134721)
==  AddAttachmentPhotoToAssets: migrating =====================================
-- change_table(:assets)
   -> 0.0273s
==  AddAttachmentPhotoToAssets: migrated (0.0276s) ============================

Migrating to AddProjectIdToAssets (20131022082744)
-- add_column(:assets, :project_id, :integer)
PG::DuplicateColumn: ERROR:  column "project_id" of relation "assets" already exists
: ALTER TABLE "assets" ADD COLUMN "project_id" integer
-- add_column(:assets, :project_id, :integer)
PG::DuplicateColumn: ERROR:  column "project_id" of relation "assets" already exists
: ALTER TABLE "assets" ADD COLUMN "project_id" integer
rake aborted!
PG::DuplicateColumn: ERROR:  column "project_id" of relation "assets" already exists
: ALTER TABLE "assets" ADD COLUMN "project_id" integer
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `exec'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `block in execute'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:425:in `block in log'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:420:in `log'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:127:in `execute'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:360:in `add_column'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql/schema_statements.rb:379:in `add_column'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:625:in `block in method_missing'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:597:in `block in say_with_time'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:597:in `say_with_time'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:617:in `method_missing'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:383:in `method_missing'
/app/db/migrate/20131022082744_add_project_id_to_assets.rb:2:in `<class:AddProjectIdToAssets>'
/app/db/migrate/20131022082744_add_project_id_to_assets.rb:1:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:718:in `load_migration'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:714:in `migration'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:708:in `disable_ddl_transaction'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:1012:in `use_transaction?'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:922:in `rescue in block in migrate'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:919:in `block in migrate'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:916:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:916:in `migrate'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:764:in `up'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:742:in `migrate'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/railties/databases.rake:42:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

这是我的表格:

 create_table "assets", force: true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "photo_file_name"
    t.string   "photo_content_type"
    t.integer  "photo_file_size"
    t.datetime "photo_updated_at"
    t.integer  "project_id"
    t.string   "video_file_name"
    t.string   "video_content_type"
    t.integer  "video_file_size"
    t.datetime "video_updated_at"
  end
add_index "projects", ["permalink"], name: "index_projects_on_permalink", using: :btree

  create_table "settings", force: true do |t|
    t.string   "title"
    t.text     "description"
    t.text     "paragraph"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "photo_file_name"
    t.string   "photo_content_type"
    t.integer  "photo_file_size"
    t.datetime "photo_updated_at"
    t.string   "video_file_name"
    t.string   "video_content_type"
    t.integer  "video_file_size"
    t.datetime "video_updated_at"
  end

很乐意需要一些帮助! :)

0 个答案:

没有答案