160 Experience
0 Lessons Completed
0 Questions Solved


Posted in Rails file upload "TypeError: can't dump File"

I am upgrading my projects ruby version from 2.3.1 to 3.0.2 with rails 6.1.4 and facing error while file upload

My error and details are:

Request you to provide any clue or idea to solve the error.

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.

```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: {
|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?

Posted in Configure ruby projects of old version

Hi Chris,

Thanks for your reply, so in this way i can run both the version projects 6.0.0 and 5.1.0 in same machine, right?

When install bundles for required gems in config file it is based on rails version 5.1.0 (if projects are in 5.1.0), right?

Posted in Configure ruby projects of old version

I am working on Rails 6.0.0 and now i want to configure one project which build in rails version 5.1.0

Do in need to install rails 5.1.0 and then install required bundle?
Or i can configure and run rails project with version 6.0.0 with not any changes.

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.