从 rails 4.2.6 升级到 Rails 5.0.0.rc1 后服务器退出
Server exiting after upgrading to Rails 5.0.0.rc1 from rails 4.2.6
我正在尝试将我应用程序的 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 个文件
gem "responders"
已创建
models/application_record.rb
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
确保所有模型都继承自这个新的 class,例如:
models/user.rb
class User < ApplicationRecord
[...]
end
有人面临同样的问题吗?
如果您正在使用邮箱,请将其添加为(使用 github 来源)以获得邮箱的主版本,这为我解决了问题
gem 'mailboxer', github: 'mailboxer/mailboxer'
我正在尝试将我应用程序的 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 个文件
gem "responders"
已创建
models/application_record.rb
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
确保所有模型都继承自这个新的 class,例如:
models/user.rb
class User < ApplicationRecord
[...]
end
有人面临同样的问题吗?
如果您正在使用邮箱,请将其添加为(使用 github 来源)以获得邮箱的主版本,这为我解决了问题
gem 'mailboxer', github: 'mailboxer/mailboxer'