问题是我正在使用Rails,并且我的应用程序在Heroku上运行,昨天我添加了宝石carrierwave
来将图像上传到该应用程序,但是由于我的应用程序只能在某些设备上使用。它可以在我的PC和iPhone 5上同时在我的iPad上使用,但在iPhone X上则不能。我了解到有些人在image_tag
上遇到问题,因此为确保将其删除,我认为这是要注册的devise
表格,因此我删除了devise
表格。仍然有问题,在某些设备上我的应用无法在其他设备上运行,当我使用Iphone X https://i.stack.imgur.com/Nqb1f.png进行注册时会显示此消息
这是我在日志中得到的:
2018-10-29T01:07:27.330739+00:00 heroku[router]: at=info method=POST path="/users" host=quiet-ravine-45803.herokuapp.com request_id=53986df2-c97d-4f5a-af54-9270808a67dd fwd="190.160.77.84" dyno=web.1 connect=0ms service=233ms status=500 bytes=1827 protocol=https
2018-10-29T01:07:27.154283+00:00 app[web.1]: I, [2018-10-29T01:07:27.154171 #4] INFO -- : [53986df2-c97d-4f5a-af54-9270808a67dd] Started POST "/users" for 190.160.77.84 at 2018-10-29 01:07:27 +0000
2018-10-29T01:07:27.156381+00:00 app[web.1]: I, [2018-10-29T01:07:27.156283 #4] INFO -- : [53986df2-c97d-4f5a-af54-9270808a67dd] Processing by Users::RegistrationsController#create as HTML
2018-10-29T01:07:27.156566+00:00 app[web.1]: I, [2018-10-29T01:07:27.156475 #4] INFO -- : [53986df2-c97d-4f5a-af54-9270808a67dd] Parameters: {"utf8"=>"✓", "authenticity_token"=>"qsIs0JKQUb6Yri0d59zBYEIWFysjr9USNofGrEvNdUhTt87gM6AuOWGIK1x1y+LAMphGZ1n6hfuzVPFHOw+a8A==", "user"=>{"name"=>"caewer", "email"=>"pefs@gmail.com", "rut"=>"13", "address"=>"qweqwd", "phone"=>"56996349898", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"}
2018-10-29T01:07:27.320359+00:00 app[web.1]: D, [2018-10-29T01:07:27.320219 #4] DEBUG -- : [53986df2-c97d-4f5a-af54-9270808a67dd] [1m[35m (0.7ms)[0m [1m[35mBEGIN[0m
2018-10-29T01:07:27.322894+00:00 app[web.1]: D, [2018-10-29T01:07:27.322714 #4] DEBUG -- : [53986df2-c97d-4f5a-af54-9270808a67dd] [1m[36mUser Exists (0.9ms)[0m [1m[34mSELECT 1 AS one FROM "users" WHERE "users"."email" = $1 LIMIT $2[0m [["email", "pefs@gmail.com"], ["LIMIT", 1]]
2018-10-29T01:07:27.325619+00:00 app[web.1]: D, [2018-10-29T01:07:27.325541 #4] DEBUG -- : [53986df2-c97d-4f5a-af54-9270808a67dd] [1m[35m (0.9ms)[0m [1m[31mROLLBACK[0m
2018-10-29T01:07:27.326271+00:00 app[web.1]: I, [2018-10-29T01:07:27.326160 #4] INFO -- : [53986df2-c97d-4f5a-af54-9270808a67dd] Completed 500 Internal Server Error in 169ms (ActiveRecord: 2.5ms)
2018-10-29T01:07:27.329176+00:00 app[web.1]: F, [2018-10-29T01:07:27.329086 #4] FATAL -- : [53986df2-c97d-4f5a-af54-9270808a67dd]
2018-10-29T01:07:27.329299+00:00 app[web.1]: F, [2018-10-29T01:07:27.329218 #4] FATAL -- : [53986df2-c97d-4f5a-af54-9270808a67dd] ActiveModel::RangeError (56996349898 is out of range for ActiveModel::Type::Integer with limit 4 bytes):
2018-10-29T01:07:27.329422+00:00 app[web.1]: F, [2018-10-29T01:07:27.329322 #4] FATAL -- : [53986df2-c97d-4f5a-af54-9270808a67dd]
2018-10-29T01:07:27.329641+00:00 app[web.1]: F, [2018-10-29T01:07:27.329496 #4] FATAL -- : [53986df2-c97d-4f5a-af54-9270808a67dd] vendor/bundle/ruby/2.5.0/gems/activemodel-5.2.1/lib/active_model/type/integer.rb:53:in `ensure_in_range'
2018-10-29T01:07:27.329644+00:00 app[web.1]: [53986df2-c97d-4f5a-af54-9270808a67dd] vendor/bundle/ruby/2.5.0/gems/activemodel-5.2.1/lib/active_model/type/integer.rb:29:in `serialize'
2018-10-29T01:07:27.329646+00:00 app[web.1]: [53986df2-c97d-4f5a-af54-9270808a67dd] vendor/bundle/ruby/2.5.0/gems/activemodel-5.2.1/lib/active_model/attribute.rb:55:in `value_for_database'
2018-10-29T01:07:27.329650+00:00 app[web.1]: [53986df2-c97d-4f5a-af54-9270808a67dd] vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/relation/query_attribute.rb:13:in `value_for_database'
2018-10-29T01:07:27.329652+00:00 app[web.1]: [53986df2-c97d-4f5a-af54-9270808a67dd] vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/quoting.rb:145:in `block in type_casted_binds'
2018-10-29T01:07:27.329654+00:00 app[web.1]: [53986df2-c97d-4f5a-af54-9270808a67dd] vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/quoting.rb:145:in `map'
答案 0 :(得分:0)
查看错误日志:
2018-10-29T01:07:27.329299+00:00 app[web.1]: F, [2018-10-29T01:07:27.329218 #4] FATAL -- : [53986df2-c97d-4f5a-af54-9270808a67dd] ActiveModel::RangeError (56996349898 is out of range for ActiveModel::Type::Integer with limit 4 bytes):
2018-10-29T01:07:27.156566+00:00 app[web.1]: I, [2018-10-29T01:07:27.156475 #4] INFO -- : [53986df2-c97d-4f5a-af54-9270808a67dd] Parameters: {"utf8"=>"✓", "authenticity_token"=>"qsIs0JKQUb6Yri0d59zBYEIWFysjr9USNofGrEvNdUhTt87gM6AuOWGIK1x1y+LAMphGZ1n6hfuzVPFHOw+a8A==", "user"=>{"name"=>"caewer", "email"=>"pefs@gmail.com", "rut"=>"13", "address"=>"qweqwd", "phone"=>"56996349898", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"}
这两行告诉您,数字56996349898大于整数的有效大小范围。编写迁移操作,以将:phone
的列数据类型更改为字符串或bigint(从整数)。为了进一步详细说明,由于整数的内存大小为4个字节(32位),因此整数可以为的最大大小为2147483647。从技术上讲,您的电话号码字段所存储的数字大约比整数类型所能容纳的数字大5400万,因此您需要增加该数字。在某些情况下,如果您想进行一些字符串操作或格式化(例如添加连字符或括号),则最好将电话号码表示为文本/字符串。