ActionView::Template::Error(参数数量错误(给定 2,预期 1))

ActionView::Template::Error (wrong number of arguments (given 2, expected 1))

提问人:Mohammad Arif 提问时间:8/26/2023 最后编辑:Mohammad Arif 更新时间:8/27/2023 访问量:125

问:

我正在从 Rails 5.2 升级到 Rails 7。当我转到任何路由时,使用 rails s 运行服务器后,它给了我 Completed 500 Internal Server Error

3.2.2/lib/ruby/gems/3.2.0/gems/sprockets/4.2.0/lib/sprockets/resolve.rb:24:in 'resolve':参数数量错误(给定 2,预期 1)(ArgumentError)

ActionView::Template::Error(参数数量错误(给定 2,预期 1)):

<%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>

<%= stylesheet_link_tag    'eye-candy', media: 'all', 'data-turbolinks-track' => true %>

<%= stylesheet_link_tag    'charts', media: 'all', 'data-turbolinks-track' => true %>

应用程序/视图/布局/应用程序.html.erb:19 app/controllers/application_controller.rb:93:在“跟踪”中

第 93 行:轨道法中的收益

def track
  _start_track_time = Time.now
  _failed           = true
  _timeout          = true
  begin
    yield
    _failed = false
  rescue => e
    # does not execute on timeouts
    _timeout = false
    raise e
  ensure
  end
end

[Rollbar] Scheduling item
[Rollbar] Sending item
[Rollbar] Sending json
[Rollbar] Got unexpected status code from Rollbar api: 429
[Rollbar] Response: {
"err": 1,
"message": "Over free plan monthly limit. Project id <> access 
token <>."
}
[Rollbar] Details: https://rollbar.com/instance/uuid?uuid=<> 
(only available if report was successful)
ActionView::Template::Error (wrong number of arguments (given 2, expected 1)):

16:       <link href='https://fonts.googleapis.com/css?family=Asap|Questrial' rel='stylesheet' type='text/css'>
17:     <% end %>
18: 
19:     <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
20:     <%= stylesheet_link_tag    'eye-candy', media: 'all', 'data-turbolinks-track' => true %>
21:     <%= stylesheet_link_tag    'charts', media: 'all', 'data-turbolinks-track' => true %>
22:     <% if %w(connect.juvo juvo.sasa.solutions).include?(request.host) %>


app/views/layouts/application.html.erb:19
app/controllers/application_controller.rb:93:in `track'
Started GET "/" for 127.0.0.1 at 2023-08-26 17:00:01 +0530
Processing by WelcomeController#index as HTML
  [1m[36mUser Load (3.2ms)[0m  [1m[34mSELECT `users`.* FROM `users` WHERE `users`.`id` = 18 ORDER BY `users`.`id` ASC LIMIT 1[0m
  [1m[36mNote Load (1.3ms)[0m  [1m[34mSELECT `notes`.* FROM `notes` WHERE `notes`.`controller` = 'welcome' AND `notes`.`action` = 'index' AND `notes`.`note_type` = 'documentation' AND (length(body)>0) ORDER BY `notes`.`id` ASC LIMIT 1[0m
  [1m[36mPartner Load (2.4ms)[0m  [1m[34mSELECT `partners`.* FROM `partners` WHERE `partners`.`id` = 6 LIMIT 1[0m
  Rendering layout layouts/application.html.erb
  Rendering welcome/index.html.erb within layouts/application
  Rendered stats/_dashboard_block.html.erb (Duration: 1.5ms | Allocations: 287)
  Rendered stats/_dashboard_block.html.erb (Duration: 0.1ms | Allocations: 56)
  Rendered stats/_dashboard_block.html.erb (Duration: 6.1ms | Allocations: 465)
  Rendered stats/_dashboard_block.html.erb (Duration: 0.1ms | Allocations: 56)
  Rendered stats/_dashboard_block.html.erb (Duration: 0.0ms | Allocations: 47)
  Rendered stats/_dashboard_block.html.erb (Duration: 0.0ms | Allocations: 55)
  Rendered stats/_dashboard_block.html.erb (Duration: 0.1ms | Allocations: 46)
  Rendered stats/_dashboard_block.html.erb (Duration: 0.0ms | Allocations: 45)
  Rendered dashboards/_system.html.erb (Duration: 13.9ms | Allocations: 2478)
  Rendered welcome/index.html.erb within layouts/application (Duration: 21.4ms | Allocations: 3065)
  Rendered layout layouts/application.html.erb (Duration: 33.8ms | Allocations: 4938)
  [1m[36mTRANSACTION (0.4ms)[0m  [1m[35mBEGIN[0m
  [1m[36mTracker Create (6.4ms)[0m  [1m[32mINSERT INTO `trackers` (`request_id`, `session_identifier`, `session_id`, `started_at`, `ended_at`, `user_agent`, `ip_address`, `host`, `controller`, `action`, `status`, `partner_id`, `user_id`, `created_at`, `updated_at`) VALUES ()[0m
  [1m[36mTRANSACTION (15.5ms)[0m  [1m[35mCOMMIT[0m
Completed 500 Internal Server 

I tried removing arguments but stylesheet_link_tag is not even taking a single argument.
Ruby-on-Rails Ruby-on-Rails-3

评论

1赞 spickermann 8/26/2023
请从应用程序的日志文件中共享错误消息,包括堆栈跟踪。
0赞 Bek 8/26/2023
这一行的代码是什么?跟踪''app/controllers/application_controller.rb:93:in
0赞 Mohammad Arif 8/26/2023
添加了 track 方法。
0赞 Mohammad Arif 8/27/2023
Rollbar 只是用于错误记录的 ruby gem。最终,无论我是否在开发模式下使用它,它都会给我带来错误。
0赞 Alex 8/28/2023
该方法在链轮 v4 之前有 2 个参数,也许在更新时将其保留在 v3。resolve

答: 暂无答案