ActiveRecord::SubclassNotFound 質問する

ActiveRecord::SubclassNotFound 質問する

Redmine を 1.3.0 から 2.0.0 にアップグレードしようとしていますが、データベースの移行で問題が発生しています。次のコマンドを実行すると、

rake db:migrate RAILS_ENV=production

次のようなエラーが表示されます

rake aborted!
uninitialized constant RAILS_ENV

エラーログは次のとおりです:

ActiveRecord::SubclassNotFound (The single-table inheritance mechanism failed to locate the subclass: 'GoogleAppsAuthSource'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite AuthSource.inheritance_column to use another column for that information.):
app/models/user.rb:139:in `try_to_login'
app/controllers/account_controller.rb:143:in `password_authentication'
app/controllers/account_controller.rb:138:in `authenticate_user'
app/controllers/account_controller.rb:30:in `login'

以下は、古い Redmine で使用しているプラ​​グインのリストです。

  1. Google アプリ プラグイン

  2. Redmine コードレビュープラグイン

  3. Redmine Hudsonプラグイン

ベストアンサー1

もし誰かがここでつまずいた場合、問題を解決するには2つの方法があります

  1. type という名前の列を使用しないでください。
  2. 列名を手動で無意味なものに設定します。

    self.inheritance_column = :_type_disabled
    

    見る:http://apidock.com/rails/ActiveRecord/Base/継承列/クラス

おすすめ記事