调试RailsAdmin错误,导致事务回滚

时间:2019-09-03 10:01:03

标签: ruby-on-rails ruby rubygems rails-admin

我正在尝试解决我的Rails应用程序中的当前问题。我的rails应用程序正在使用RailsAdmin,尝试通过通用的RailsAdmin选项上传文件后出现问题。

因此,此应用使用的是Ruby 2.5.3,RailsAdmin 1.4.2和Rails 5.2.3。

似乎我正在运行一个无提示错误...也许是一种模型验证或类似的购买,我什至在调试模式下都没有得到任何相关的输出。

问题是我不确定如何调试此问题,因为这些操作是在rails-admin gem中处理的。 即使我将RubyMine与调试功能一起使用,我也不知道在哪里设置断点,因为这是由gem处理的。我试图破坏一些初始化程序,但是当然没有达到预期的效果。

所以我将感谢所有提示和帮助,这些提示和帮助可帮助我调试此问题!

最诚挚的问候,

Tunnelblick


调试输出:

Started POST "/administrator/document/new" for <src_ip> at 2019-09-03 11:47:46 +0200
Processing by RailsAdmin::MainController#new as JS
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"<token>", "document"=>{"title"=>"Testimage", "description"=>"", "page_ids"=>["", "", "151"], "file"=>#<ActionDispatch::Http::UploadedFile:0x00007f4ebbf196e8 @tempfile=#<Tempfile:/tmp/RackMultipart20190903-3614-gbt3ad.png>, @original_filename="generic_testimage.png", @content_type="image/png", @headers="Content-Disposition: form-data; name=\"document[file]\"; filename=\"generic_testimage.png\"\r\nContent-Type: image/png\r\n">}, "remotipart_submitted"=>"true", "X-Requested-With"=>"IFrame", "X-HTTP-Accept"=>"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01", "model_name"=>"document"}
  User Load (0.7ms)  SELECT  `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1
  ↳ config/initializers/rails_admin.rb:97
   (0.9ms)  SELECT `user_roles`.`role_id` FROM `user_roles` WHERE `user_roles`.`user_id` = 1
  ↳ app/models/user.rb:236
   (0.5ms)  SELECT `roles`.`name` FROM `roles` WHERE `roles`.`id` = 1
  ↳ app/models/user.rb:236
  Disk Storage (4.5ms) Uploaded file to key: HsSaBijYwg3JLeR8dV7akmpF (checksum: /QSj27UArM/yWCLulQaTpA==)
   (0.3ms)  BEGIN
  ↳ /home/testvm01/.rvm/gems/ruby-2.5.3@<gemset>/bundler/gems/activerecord-sqlserver-adapter-1105d02d6284/lib/active_record/connection_adapters/sqlserver/transaction.rb:38
  ActiveStorage::Blob Create (0.6ms)  INSERT INTO `active_storage_blobs` (`key`, `filename`, `content_type`, `metadata`, `byte_size`, `checksum`, `created_at`) VALUES ('HsSaBijYwg3JLeR8dV7akmpF', 'generic_testimage.png', 'image/png', '{\"identified\":true}', 2673, '/QSj27UArM/yWCLulQaTpA==', '2019-09-03 09:47:46')
  ↳ /home/testvm01/.rvm/gems/ruby-2.5.3@<gemset>/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
   (3.6ms)  COMMIT
  ↳ /home/testvm01/.rvm/gems/ruby-2.5.3@<gemset>/bundler/gems/activerecord-sqlserver-adapter-1105d02d6284/lib/active_record/connection_adapters/sqlserver/transaction.rb:42
   (0.3ms)  BEGIN
  ↳ /home/testvm01/.rvm/gems/ruby-2.5.3@<gemset>/bundler/gems/activerecord-sqlserver-adapter-1105d02d6284/lib/active_record/connection_adapters/sqlserver/transaction.rb:38
   (0.4ms)  COMMIT
  ↳ /home/testvm01/.rvm/gems/ruby-2.5.3@<gemset>/bundler/gems/activerecord-sqlserver-adapter-1105d02d6284/lib/active_record/connection_adapters/sqlserver/transaction.rb:42
  Page Load (0.5ms)  SELECT `pages`.* FROM `pages` WHERE `pages`.`id` = 151
  ↳ /home/testvm01/.rvm/gems/ruby-2.5.3@<gemset>/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
   (0.3ms)  BEGIN
  ↳ /home/testvm01/.rvm/gems/ruby-2.5.3@<gemset>/bundler/gems/activerecord-sqlserver-adapter-1105d02d6284/lib/active_record/connection_adapters/sqlserver/transaction.rb:38


   (0.2ms)  ROLLBACK


  ↳ /home/testvm01/.rvm/gems/ruby-2.5.3@<gemset>/bundler/gems/activerecord-sqlserver-adapter-1105d02d6284/lib/active_record/connection_adapters/sqlserver/transaction.rb:47
  Rendering /home/testvm01/.rvm/gems/ruby-2.5.3@<gemset>/gems/rails_admin-1.4.2/app/views/rails_admin/main/new.html.haml
  Rendered /home/testvm01/.rvm/gems/ruby-2.5.3@<gemset>/gems/rails_admin-1.4.2/app/views/rails_admin/main/_form_field.html.haml (3.9ms)
  Rendered /home/testvm01/.rvm/gems/ruby-2.5.3@<gemset>/gems/rails_admin-1.4.2/app/views/rails_admin/main/_form_text.html.haml (3.6ms)
  Rendered /home/testvm01/.rvm/gems/ruby-2.5.3@<gemset>/gems/rails_admin-1.4.2/app/views/rails_admin/main/_form_file_upload.html.haml (7.8ms)
   (0.5ms)  SELECT COUNT(*) FROM `pages`
  ↳ /home/testvm01/.rvm/gems/ruby-2.5.3@<gemset>/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
  CACHE  (0.0ms)  SELECT COUNT(*) FROM `pages`
  ↳ /home/testvm01/.rvm/gems/ruby-2.5.3@<gemset>/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
  Rendered /home/testvm01/.rvm/gems/ruby-2.5.3@<gemset>/gems/rails_admin-1.4.2/app/views/rails_admin/main/_form_filtering_multiselect.html.haml (15.9ms)
  Rendered /home/testvm01/.rvm/gems/ruby-2.5.3@<gemset>/gems/rails_admin-1.4.2/app/views/rails_admin/main/_submit_buttons.html.haml (14.2ms)
  Rendered /home/testvm01/.rvm/gems/ruby-2.5.3@<gemset>/gems/rails_admin-1.4.2/app/views/rails_admin/main/new.html.haml (70.9ms)
Completed 406 Not Acceptable in 124ms (Views: 76.5ms | ActiveRecord: 8.8ms)


<src_ip> - - [03/Sep/2019:11:47:46 CEST] "POST /administrator/document/new HTTP/1.1" 406 5828
http://<dst_ip>:3000/administrator/Page/151/edit -> /administrator/document/new
Started GET "/rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBb1VEIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--01b687f90aa49f3bfd52fe06cfb950eef8711461/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9MY21WemFYcGxTU0lOTVRBd2VERXdNRDRHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--597b84b3c8f143e08ed73e02d88e0aee694d1066/generic_testimage.png" for <src_ip> at 2019-09-03 11:47:46 +0200
Processing by ActiveStorage::RepresentationsController#show as PNG
  Parameters: {"signed_blob_id"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBb1VEIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--01b687f90aa49f3bfd52fe06cfb950eef8711461", "variation_key"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9MY21WemFYcGxTU0lOTVRBd2VERXdNRDRHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--597b84b3c8f143e08ed73e02d88e0aee694d1066", "filename"=>"generic_testimage"}
  ActiveStorage::Blob Load (2.5ms)  SELECT  `active_storage_blobs`.* FROM `active_storage_blobs` WHERE `active_storage_blobs`.`id` = 901 LIMIT 1
  ↳ /home/testvm01/.rvm/gems/ruby-2.5.3@<gemset>/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
  Disk Storage (0.1ms) Checked if file exists at key: variants/HsSaBijYwg3JLeR8dV7akmpF/64ff10e27609a8b1f320398d41a1f5791aeb2e108f429b203d5f3c650e0b744d (no)
  Disk Storage (0.1ms) Downloaded file from key: HsSaBijYwg3JLeR8dV7akmpF
  Disk Storage (0.3ms) Uploaded file to key: variants/HsSaBijYwg3JLeR8dV7akmpF/64ff10e27609a8b1f320398d41a1f5791aeb2e108f429b203d5f3c650e0b744d
  Disk Storage (0.8ms) Generated URL for file at key: variants/HsSaBijYwg3JLeR8dV7akmpF/64ff10e27609a8b1f320398d41a1f5791aeb2e108f429b203d5f3c650e0b744d (http://<dst_ip>:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9JYTJWNVNTSm5kbUZ5YVdGdWRITXZTSE5UWVVKcGFsbDNaek5LVEdWU09HUldOMkZyYlhCR0x6WTBabVl4TUdVeU56WXdPV0U0WWpGbU16SXdNems0WkRReFlURm1OVGM1TVdGbFlqSmxNVEE0WmpReU9XSXlNRE5rTldZell6WTFNR1V3WWpjME5HUUdPZ1pGVkRvUVpHbHpjRzl6YVhScGIyNUpJbFZwYm14cGJtVTdJR1pwYkdWdVlXMWxQU0puWlc1bGNtbGpYM1JsYzNScGJXRm5aUzV3Ym1jaU95Qm1hV3hsYm1GdFpTbzlWVlJHTFRnbkoyZGxibVZ5YVdOZmRHVnpkR2x0WVdkbExuQnVad1k3QmxRNkVXTnZiblJsYm5SZmRIbHdaVWtpRG1sdFlXZGxMM0J1WndZN0JsUT0iLCJleHAiOiIyMDE5LTA5LTAzVDA5OjUyOjQ2LjU4NVoiLCJwdXIiOiJibG9iX2tleSJ9fQ==--c5bcf6d4ef2e2800968e21be38b234711a8d43a9/generic_testimage.png?content_type=image%2Fpng&disposition=inline%3B+filename%3D%22generic_testimage.png%22%3B+filename%2A%3DUTF-8%27%27generic_testimage.png)
Redirected to http://<dst_ip>:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9JYTJWNVNTSm5kbUZ5YVdGdWRITXZTSE5UWVVKcGFsbDNaek5LVEdWU09HUldOMkZyYlhCR0x6WTBabVl4TUdVeU56WXdPV0U0WWpGbU16SXdNems0WkRReFlURm1OVGM1TVdGbFlqSmxNVEE0WmpReU9XSXlNRE5rTldZell6WTFNR1V3WWpjME5HUUdPZ1pGVkRvUVpHbHpjRzl6YVhScGIyNUpJbFZwYm14cGJtVTdJR1pwYkdWdVlXMWxQU0puWlc1bGNtbGpYM1JsYzNScGJXRm5aUzV3Ym1jaU95Qm1hV3hsYm1GdFpTbzlWVlJHTFRnbkoyZGxibVZ5YVdOZmRHVnpkR2x0WVdkbExuQnVad1k3QmxRNkVXTnZiblJsYm5SZmRIbHdaVWtpRG1sdFlXZGxMM0J1WndZN0JsUT0iLCJleHAiOiIyMDE5LTA5LTAzVDA5OjUyOjQ2LjU4NVoiLCJwdXIiOiJibG9iX2tleSJ9fQ==--c5bcf6d4ef2e2800968e21be38b234711a8d43a9/generic_testimage.png?content_type=image%2Fpng&disposition=inline%3B+filename%3D%22generic_testimage.png%22%3B+filename%2A%3DUTF-8%27%27generic_testimage.png
Completed 302 Found in 72ms (ActiveRecord: 2.5ms)


<src_ip> - - [03/Sep/2019:11:47:46 CEST] "GET /rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBb1VEIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--01b687f90aa49f3bfd52fe06cfb950eef8711461/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9MY21WemFYcGxTU0lOTVRBd2VERXdNRDRHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--597b84b3c8f143e08ed73e02d88e0aee694d1066/generic_testimage.png HTTP/1.1" 302 863
http://<dst_ip>:3000/administrator/Page/151/edit -> /rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBb1VEIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--01b687f90aa49f3bfd52fe06cfb950eef8711461/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9MY21WemFYcGxTU0lOTVRBd2VERXdNRDRHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--597b84b3c8f143e08ed73e02d88e0aee694d1066/generic_testimage.png
Started GET "/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9JYTJWNVNTSm5kbUZ5YVdGdWRITXZTSE5UWVVKcGFsbDNaek5LVEdWU09HUldOMkZyYlhCR0x6WTBabVl4TUdVeU56WXdPV0U0WWpGbU16SXdNems0WkRReFlURm1OVGM1TVdGbFlqSmxNVEE0WmpReU9XSXlNRE5rTldZell6WTFNR1V3WWpjME5HUUdPZ1pGVkRvUVpHbHpjRzl6YVhScGIyNUpJbFZwYm14cGJtVTdJR1pwYkdWdVlXMWxQU0puWlc1bGNtbGpYM1JsYzNScGJXRm5aUzV3Ym1jaU95Qm1hV3hsYm1GdFpTbzlWVlJHTFRnbkoyZGxibVZ5YVdOZmRHVnpkR2x0WVdkbExuQnVad1k3QmxRNkVXTnZiblJsYm5SZmRIbHdaVWtpRG1sdFlXZGxMM0J1WndZN0JsUT0iLCJleHAiOiIyMDE5LTA5LTAzVDA5OjUyOjQ2LjU4NVoiLCJwdXIiOiJibG9iX2tleSJ9fQ==--c5bcf6d4ef2e2800968e21be38b234711a8d43a9/generic_testimage.png?content_type=image%2Fpng&disposition=inline%3B+filename%3D%22generic_testimage.png%22%3B+filename%2A%3DUTF-8%27%27generic_testimage.png" for <src_ip> at 2019-09-03 11:47:46 +0200
Processing by ActiveStorage::DiskController#show as PNG
  Parameters: {"content_type"=>"image/png", "disposition"=>"inline; filename=\"generic_testimage.png\"; filename*=UTF-8''generic_testimage.png", "encoded_key"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9JYTJWNVNTSm5kbUZ5YVdGdWRITXZTSE5UWVVKcGFsbDNaek5LVEdWU09HUldOMkZyYlhCR0x6WTBabVl4TUdVeU56WXdPV0U0WWpGbU16SXdNems0WkRReFlURm1OVGM1TVdGbFlqSmxNVEE0WmpReU9XSXlNRE5rTldZell6WTFNR1V3WWpjME5HUUdPZ1pGVkRvUVpHbHpjRzl6YVhScGIyNUpJbFZwYm14cGJtVTdJR1pwYkdWdVlXMWxQU0puWlc1bGNtbGpYM1JsYzNScGJXRm5aUzV3Ym1jaU95Qm1hV3hsYm1GdFpTbzlWVlJHTFRnbkoyZGxibVZ5YVdOZmRHVnpkR2x0WVdkbExuQnVad1k3QmxRNkVXTnZiblJsYm5SZmRIbHdaVWtpRG1sdFlXZGxMM0J1WndZN0JsUT0iLCJleHAiOiIyMDE5LTA5LTAzVDA5OjUyOjQ2LjU4NVoiLCJwdXIiOiJibG9iX2tleSJ9fQ==--c5bcf6d4ef2e2800968e21be38b234711a8d43a9", "filename"=>"generic_testimage"}
Completed 200 OK in 1ms (ActiveRecord: 0.0ms)


<src_ip> - - [03/Sep/2019:11:47:46 CEST] "GET /rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9JYTJWNVNTSm5kbUZ5YVdGdWRITXZTSE5UWVVKcGFsbDNaek5LVEdWU09HUldOMkZyYlhCR0x6WTBabVl4TUdVeU56WXdPV0U0WWpGbU16SXdNems0WkRReFlURm1OVGM1TVdGbFlqSmxNVEE0WmpReU9XSXlNRE5rTldZell6WTFNR1V3WWpjME5HUUdPZ1pGVkRvUVpHbHpjRzl6YVhScGIyNUpJbFZwYm14cGJtVTdJR1pwYkdWdVlXMWxQU0puWlc1bGNtbGpYM1JsYzNScGJXRm5aUzV3Ym1jaU95Qm1hV3hsYm1GdFpTbzlWVlJHTFRnbkoyZGxibVZ5YVdOZmRHVnpkR2x0WVdkbExuQnVad1k3QmxRNkVXTnZiblJsYm5SZmRIbHdaVWtpRG1sdFlXZGxMM0J1WndZN0JsUT0iLCJleHAiOiIyMDE5LTA5LTAzVDA5OjUyOjQ2LjU4NVoiLCJwdXIiOiJibG9iX2tleSJ9fQ==--c5bcf6d4ef2e2800968e21be38b234711a8d43a9/generic_testimage.png?content_type=image%2Fpng&disposition=inline%3B+filename%3D%22generic_testimage.png%22%3B+filename%2A%3DUTF-8%27%27generic_testimage.png HTTP/1.1" 200 830
http://<dst_ip>:3000/administrator/Page/151/edit -> /rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9JYTJWNVNTSm5kbUZ5YVdGdWRITXZTSE5UWVVKcGFsbDNaek5LVEdWU09HUldOMkZyYlhCR0x6WTBabVl4TUdVeU56WXdPV0U0WWpGbU16SXdNems0WkRReFlURm1OVGM1TVdGbFlqSmxNVEE0WmpReU9XSXlNRE5rTldZell6WTFNR1V3WWpjME5HUUdPZ1pGVkRvUVpHbHpjRzl6YVhScGIyNUpJbFZwYm14cGJtVTdJR1pwYkdWdVlXMWxQU0puWlc1bGNtbGpYM1JsYzNScGJXRm5aUzV3Ym1jaU95Qm1hV3hsYm1GdFpTbzlWVlJHTFRnbkoyZGxibVZ5YVdOZmRHVnpkR2x0WVdkbExuQnVad1k3QmxRNkVXTnZiblJsYm5SZmRIbHdaVWtpRG1sdFlXZGxMM0J1WndZN0JsUT0iLCJleHAiOiIyMDE5LTA5LTAzVDA5OjUyOjQ2LjU4NVoiLCJwdXIiOiJibG9iX2tleSJ9fQ==--c5bcf6d4ef2e2800968e21be38b234711a8d43a9/generic_testimage.png?content_type=image%2Fpng&disposition=inline%3B+filename%3D%22generic_testimage.png%22%3B+filename%2A%3DUTF-8%27%27generic_testimage.png


RailsAdmin MainController

RailsAdmin::Config::Actions.all.each do |action|
      class_eval <<-EOS, __FILE__, __LINE__ + 1
        def #{action.action_name}
          action = RailsAdmin::Config::Actions.find('#{action.action_name}'.to_sym)
          @authorization_adapter.try(:authorize, action.authorization_key, @abstract_model, @object)
          @action = action.with({controller: self, abstract_model: @abstract_model, object: @object})
          fail(ActionNotAllowed) unless @action.enabled?
          @page_name = wording_for(:title)

          instance_eval &@action.controller
        end
      EOS
    end

0 个答案:

没有答案