Ruby on Rails 6 is the latest version of Ruby on Rails, "an open-source web framework that's optimized for programmer happiness and sustainable productivity."
Questions tagged [ruby-on-rails-6]
2084 questions
15
votes
3 answers
What's the correct way of defining secret_key_base on Rails 6?
What's the correct way of defining secret_key_base on Rails 6 now that we have per-environment credentials?
My environment has the variable SECRET_KEY_BASE but Rails is not picking it up. I tried defining secret_key_base in…

Marta Silva
- 733
- 1
- 6
- 13
15
votes
4 answers
How to use cocoon gem in Rails 6
Have been using cocoon gem for nested forms in rails 4 & rails 5 apps. Currently, I was updating one of the rails 5.2 app (which is using cocoon gem) to rails 6.
As rails 6 is using webpacker, so I tired to require cocoon javascript in…

Sikandar Tariq
- 1,296
- 1
- 13
- 29
15
votes
4 answers
how to use js files from Gem in rails 6 application
So I have been using rails for quite a while. But with Rails 6 I have been really struggling to get moving. I have some custom gems I use for assets and things and I cannot figure out how to load the js files.
What I am used to
application.js
//=…

Rockwell Rice
- 3,376
- 5
- 33
- 61
15
votes
6 answers
How do I drop a foreign key if it exists in Ruby on Rails?
There's a function called index_exists? in ActionRecord, but no foreign_key_exists? on Rails 4.2.7.
So when I call remove_foreign_key :parties, :franchise_groups on some databases it breaks.
What should I use?
Update
My code
class…

Richard
- 14,798
- 21
- 70
- 103
14
votes
4 answers
Sidekiq keeps yelling at CSRF protection, but the route is mounted inside Rails.application.routes.draw
I have a Rails 6.0.3.5 API, and i'm NOT using Devise for authentication.
When I try to access sidekiq UI, it yells:
Sidekiq::Web needs a valid Rack session for CSRF protection. If this is a Rails app, make sure you mount Sidekiq::Web *inside* your…

João Ramires
- 723
- 10
- 23
14
votes
2 answers
Omit action mailbox, activestorage, and conductor routes from bin/rails routes in Rails 6?
I have a brand new Rails 6 app and without anything in the config/routes.rb, the output of bin/rails routes has a massive list of very long urls for ActiveStorage, Action Mailbox, and conductor.
This is making bin/rails routes completely useless as…

davetron5000
- 24,123
- 11
- 70
- 98
14
votes
1 answer
Ruby 2.6.5 and PostgreSQL pg-gem segmentation fault
From the console I cannot do any operation that touches the database. I get a Segmentation fault.
.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/pg-1.1.4/lib/pg.rb:56: [BUG] Segmentation fault at 0x0000000000000110
ruby 2.6.5p114 (2019-10-01…

phil
- 4,668
- 4
- 33
- 51
13
votes
2 answers
Is there any way to disable image/attachment part for action text in Rails 6?
Do we have a way to disable attachment for action text? something like below
has_rich_text :content, attachment: false
So that, We can remove active_storage_blobs, active_storage_attachments tables from db. Only having action_text_rich_texts table…

Ramyani
- 1,019
- 1
- 9
- 12
13
votes
3 answers
DEPRECATION WARNING: ActionView::Base instances should be constructed with a lookup context, assignments, and a controller
I migrate an application from rails 5.2 to rails 6. There is only have one thing left to do but I don't know how.
I have this depreciation warning:
DEPRECATION WARNING: ActionView::Base instances should be constructed with a lookup context,…

cercxtrova
- 1,555
- 13
- 30
13
votes
3 answers
Rails 6 & deliver_later doesn't affect ActionMailer::Base.deliveries
After upgrading to Rails 6 I am noticing that default mailer's .deliver_later is not working the same as in Rails 5.
Configuration:
config.active_job.queue_adapter = :inline
When running Mailer.register_email(...).deliver_later - nothing is…

knagode
- 5,816
- 5
- 49
- 65
12
votes
1 answer
ERROR: Error installing racc: ERROR: Failed to build gem native extension
Ubuntu 20.04.2 LTS
Installing Rails 6.1.3.1
Ruby: 2.6.5
Installing rails:
gem install rails -v 6.1.3.1 --no-doc
Fails to install racc-1.5.2
Trying to manually install racc-1.5.2:
gem install racc -v '1.5.2' --source 'https://rubygems.org/'…

Eric Wanchic
- 2,046
- 1
- 23
- 26
12
votes
1 answer
How to set RAILS_PRODUCTION_KEY config var on a Rails 6 app on Heroku
I created a new Rails 6 app and since it supports Multi Environment Credentials I'm trying to use the RAILS_PRODUCTION_KEY config var and delete the default RAILS_MASTER_KEY
heroku config:unset RAILS_MASTER_KEY
heroku config:set…

vince
- 2,374
- 4
- 23
- 39
12
votes
3 answers
What is the correct way to update images with has_many_attached in Rails 6
I have a Rails 6 app that uses Active Storage to store multiple images to a model (Activity) with has_many_attached.
I don't understand how to append extra images instead of replacing the existing images. When I upload images the first time they…

don_Bigote
- 896
- 7
- 33
12
votes
1 answer
Ruby on Rails 6 + Docker = Webpacker::Manifest::MissingEntryError?
Trying to run my Rails app as a Docker container but got the following error when opening a page:
Webpacker can't find application in /app/public/packs/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for…

divideByZero
- 1,120
- 16
- 27
12
votes
2 answers
ActionView::Template::Error: 785: unexpected token at ''
This error happens randomly during testing (standard Rails testing toolkit) after running rails test. Failed test can be any test in any file.
This error happens usually in testing environment during CI/CD process. Locally it occurs very…

Dmitry Matveyev
- 307
- 1
- 10