Ask A Question

Notifications

You’re not receiving notifications from this thread.

Rails 6 ActionView::MissingTemplate Missing template errors/500

MohitChavda asked in Rails

I am working on to upgrade existing project and upgrade version from ruby 2.3.1 to version to 3.0.1 (rails 6.1.4) with related gems.

After uploading image, when execute render json, generate error for missing template.

Error:
```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"```

Code:
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

Where: view_context.asset_for_mustache is a function to return object value and working properly.

We have used paperclip (now kt-paperclip) for file upload on s3 bucket. (as of now, we don’t want to change to ActiveStorage) After creating new assets when try to render with render json, throws the error.

Any suggestion, how to solve the issue? or where need to check?

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,329+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2024 GoRails, LLC. All rights reserved.