我将我的应用程序从Rails 3.2.13迁移到4.2.6,当我尝试运行应用程序并提交表单时,这是我得到的错误:
TypeError - 无法将哈希转换为整数:activerecord(4.2.6) LIB / active_record / connection_adapters /抽象/ database_statements.rb:325:在
sanitize_limit' activerecord (4.2.6) lib/active_record/relation/query_methods.rb:872:in
build_arel'
activerecord(4.2.6) lib / active_record / relation / query_methods.rb:858:在arel'
exec_queries' activerecord(4.2.6) lib / active_record / relation.rb:515:在
activerecord (4.2.6) lib/active_record/relation.rb:639:inload' activerecord (4.2.6) lib/active_record/relation.rb:243:in
to_a' activerecord(4.2.6) LIB / active_record /关系/ finder_methods.rb:500:在find_nth_with_limit' activerecord (4.2.6) lib/active_record/relation/finder_methods.rb:125:in
第一'
activerecord(4.2.6)lib / active_record / querying.rb:3:infirst'
get'设计(1.4.9)lib / devise / models / authenticatable.rb:90:in
orm_adapter (0.0.7) lib/orm_adapter/adapters/active_record.rb:42:inserialize_from_session' devise (1.4.9) lib/devise/rails/warden_compat.rb:27:in
反序列'监狱长(1.0.6) lib / warden / session_serializer.rb:31:fetch' warden (1.0.6) lib/warden/proxy.rb:182:in
用户'监狱长(1.0.6) lib / warden / proxy.rb:278:在_perform_authentication' warden (1.0.6) lib/warden/proxy.rb:90:in
身份验证'设计(1.4.9) lib / devise / controllers / helpers.rb:53:incurrent_user' devise (1.4.9) lib/devise/controllers/helpers.rb:49:in
user_signed_in?'
app / controllers / application_controller.rb:102:在`set_user_time_zone'
这是我在控制器代码中的方法:
def set_user_time_zone
Time.zone = current_user.time_zone if user_signed_in?
end
我是否需要修改此方法或在配置中添加任何代码?请帮忙。