服务器从rails 4.2.6升级到Rails 5.0.0.rc1后退出

时间:2016-05-22 18:55:06

标签: ruby-on-rails ruby-on-rails-5

我正在尝试将我的应用程序的rails版本从4.2.6升级到5但是我遇到了以下错误。

suramai@rails-tutorial:~/workspace/converse (rails5update) $ rails server -b $IP -p $PORT
=> Booting WEBrick
=> Rails 5.0.0.rc1 application starting in development on http://0.0.0.0:8080
=> Run `rails server -h` for more startup options
Exiting
/usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0.rc1/lib/active_support/core_ext/hash/keys.rb:79:in `block in assert_valid_keys': Unknown key: :order. Valid keys are: :class_name, :anonymous_class, :foreign_key, :validate, :autosave, :table_name, :before_add, :after_add, :before_remove, :after_remove, :extend, :primary_key, :dependent, :as, :through, :source, :source_type, :inverse_of, :counter_cache, :join_table, :foreign_type, :index_errors (ArgumentError)
        from /usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0.rc1/lib/active_support/core_ext/hash/keys.rb:77:in `each_key'
        from /usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0.rc1/lib/active_support/core_ext/hash/keys.rb:77:in `assert_valid_keys'
        from /usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.rc1/lib/active_record/associations/builder/association.rb:78:in `validate_options'

更改了范围

  #default_scope -> { order: 'created_at DESC' }
  scope :created_at, ->  { order('created_at DESC') }

添加了宝石文件

gem "responders"

创建

models/application_record.rb

class ApplicationRecord < ActiveRecord::Base
  self.abstract_class = true
end

确保所有模型都继承自此新类,例如:

models/user.rb

class User < ApplicationRecord
  [...]
end

任何人都面临同样的问题?

1 个答案:

答案 0 :(得分:4)

如果您正在使用邮箱,请将其添加为(使用github源代码)以获取邮箱的主版本,这样就解决了我的问题

gem'boxerer',github:'mailboxer / mailboxer'