0

调用时出现错误render json

assets =>
0 => #<ActionDispatch::Http::UploadedFile:0x000000000ce165c0>
()    *Cookies:* *_{"session_id"=>"52d50d...", "profilin"=>"p=t...", "CloudFront-Policy"=>"eyJTdG...", "CloudFront-Signature"=>"TSA9KD...", "CloudFront-Key-Pair-Id"=>"ABBABB...", "ga"=>"GA1.2....", "gid"=>"GA1.2....", "gat"=>"1..."}_*
()    *Exception Message:*
ActionView::MissingTemplate Missing template errors/500, application/500 with {:locale=>[:en], :formats=>[:json], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :coffee, :mustache]}. Searched in:
  * "/media/test/DATA/userdrive/tube/app/views"
  * "/home/test/.rvm/gems/ruby-3.0.1/gems/actiontext-6.1.4/app/views"
  * "/home/test/.rvm/gems/ruby-3.0.1/gems/actionmailbox-6.1.4/app/views"

代码:

render json: { 
  assets: new_assets_list.map { 
    |asset| (asset.nil? ? nil : view_context.asset_for_mustache(asset, @parent, nil, false)) 
 }, error_asset_arr: error_asset_list_arr }, status: 200

view_context.asset_for_mustache返回对象值并正常工作的函数在哪里。

我正在使用相关的 gem 升级现有项目并将版本从 ruby​​ 2.3.1 升级到 3.0.1 (rails 6.1.4)。

任何建议,如何解决这个问题?或者我需要在哪里检查?

4

0 回答 0