• 溜溜梅

  • 这是 ruby 3.1 的一个改动

    Module#prepend behavior change
    Now, when module is prepended to the class, it always becomes first in the ancestor chain; even if it was already included.

  • 在终端下是可以打开的,我改成了使用图片的 metadata。 感谢🙏。

  • 感谢,我去试试看。 😂 继续改进。

  • 报错信息是这样的

    Net::ReadTimeout in UploadQrCodes#index
    Showing /Users/fc/app_server/app/views/upload_qr_codes/index.html.erb where line #22 raised:
    
    Net::ReadTimeout
    Extracted source (around line #41):
    39
    40   def crop_param(url)
    41      image = MiniMagick::Image.open(url)
    42      width = image.width
    43      height = image.height
    44      "50%x45%+#{width*0.25}+#{height*0.17}"
    
    Rails.root: /Users/fc/app_server
    
    Application Trace | Framework Trace | Full Trace
    app/models/upload_qr_code.rb:41:in `crop_param'
    app/views/upload_qr_codes/index.html.erb:22:in `block in _app_views_upload_qr_codes_index_html_erb__2215282283866048584_70323507321140'
    app/views/upload_qr_codes/index.html.erb:16:in `_app_views_upload_qr_codes_index_html_erb__2215282283866048584_70323507321140'
    
    Full Trace
    
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/net/protocol.rb:181:in `rbuf_fill'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/net/protocol.rb:157:in `readuntil'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/net/protocol.rb:167:in `readline'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/net/http/response.rb:40:in `read_status_line'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/net/http/response.rb:29:in `read_new'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/net/http.rb:1494:in `block in transport_request'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/net/http.rb:1491:in `catch'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/net/http.rb:1491:in `transport_request'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/net/http.rb:1464:in `request'
    newrelic_rpm (5.4.0.347) lib/new_relic/agent/instrumentation/net.rb:36:in `block in request_with_newrelic_trace'
    newrelic_rpm (5.4.0.347) lib/new_relic/agent.rb:501:in `disable_all_tracing'
    newrelic_rpm (5.4.0.347) lib/new_relic/agent/instrumentation/net.rb:35:in `request_with_newrelic_trace'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/open-uri.rb:343:in `block in open_http'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/net/http.rb:910:in `start'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/open-uri.rb:337:in `open_http'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/open-uri.rb:755:in `buffer_open'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/open-uri.rb:226:in `block in open_loop'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/open-uri.rb:224:in `catch'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/open-uri.rb:224:in `open_loop'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/open-uri.rb:165:in `open_uri'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/open-uri.rb:735:in `open'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/open-uri.rb:35:in `open'
    mini_magick (4.9.3) lib/mini_magick/image.rb:94:in `open'
    app/models/upload_qr_code.rb:41:in `crop_param'
    app/views/upload_qr_codes/index.html.erb:22:in `block in _app_views_upload_qr_codes_index_html_erb__2215282283866048584_70323507321140'
    activerecord (5.2.1) lib/active_record/relation/delegation.rb:41:in `each'
    activerecord (5.2.1) lib/active_record/relation/delegation.rb:41:in `each'
    app/views/upload_qr_codes/index.html.erb:16:in `_app_views_upload_qr_codes_index_html_erb__2215282283866048584_70323507321140'
    actionview (5.2.1) lib/action_view/template.rb:159:in `block in render'
    activesupport (5.2.1) lib/active_support/notifications.rb:168:in `block in instrument'
    activesupport (5.2.1) lib/active_support/notifications/instrumenter.rb:23:in `instrument'
    activesupport (5.2.1) lib/active_support/notifications.rb:168:in `instrument'
    actionview (5.2.1) lib/action_view/template.rb:354:in `instrument_render_template'
    actionview (5.2.1) lib/action_view/template.rb:157:in `render'
    actionview (5.2.1) lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template'
    actionview (5.2.1) lib/action_view/renderer/abstract_renderer.rb:44:in `block in instrument'
    activesupport (5.2.1) lib/active_support/notifications.rb:168:in `block in instrument'
    activesupport (5.2.1) lib/active_support/notifications/instrumenter.rb:23:in `instrument'
    activesupport (5.2.1) lib/active_support/notifications.rb:168:in `instrument'
    actionview (5.2.1) lib/action_view/renderer/abstract_renderer.rb:43:in `instrument'
    actionview (5.2.1) lib/action_view/renderer/template_renderer.rb:53:in `block in render_template'
    actionview (5.2.1) lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
    actionview (5.2.1) lib/action_view/renderer/template_renderer.rb:52:in `render_template'
    actionview (5.2.1) lib/action_view/renderer/template_renderer.rb:16:in `render'
    actionview (5.2.1) lib/action_view/renderer/renderer.rb:44:in `render_template'
    actionview (5.2.1) lib/action_view/renderer/renderer.rb:25:in `render'
    actionview (5.2.1) lib/action_view/rendering.rb:103:in `_render_template'
    actionpack (5.2.1) lib/action_controller/metal/streaming.rb:219:in `_render_template'
    actionview (5.2.1) lib/action_view/rendering.rb:84:in `render_to_body'
    actionpack (5.2.1) lib/action_controller/metal/rendering.rb:52:in `render_to_body'
    actionpack (5.2.1) lib/action_controller/metal/renderers.rb:142:in `render_to_body'
    actionpack (5.2.1) lib/abstract_controller/rendering.rb:25:in `render'
    actionpack (5.2.1) lib/action_controller/metal/rendering.rb:36:in `render'
    actionpack (5.2.1) lib/action_controller/metal/instrumentation.rb:46:in `block (2 levels) in render'
    activesupport (5.2.1) lib/active_support/core_ext/benchmark.rb:14:in `block in ms'
    /Users/fc/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
    
    
  • url 是这样的

    http://localhost:3000/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBIQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--1d485442831c9ac8fbbb5cae15942c2a8217b8fb/qr_code_test_1.png