Questions tagged [ruby-on-rails-6]

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."

2084 questions
10
votes
3 answers

ActiveAdmin :select drop-down defaults to current value in development but defaults to blank in production

I have the following ActiveAdmin form: form do |f| f.inputs "Timesheet Details" do f.input :jobs_assigned_worker, :label => "Worker", as: :select, collection: Worker.all f.input :worked_time_hours, :label => "Worked Time (Hours)" …
sixty4bit
  • 7,422
  • 7
  • 33
  • 57
9
votes
1 answer

Use Import Maps and Stimulus with Rails 6

I'm currently on Rails 6.0.4 and I want to use Stimulus to build a new page. There's a lot of work still to do before upgrading to Rails 7, so I want to use importmaps and stimulus with Rails 6 if possible. But so far I haven't been able to get a…
9
votes
3 answers

Model associations problem: NoMethodError: undefined method `extensions' for #

I'm currently upgrading my rails 5.2 app to rails 6.0 while following the upgrading guide. Everything seems to work perfectly fine until I've encountered an error when one of my user classes (label or artist) interacts with the links model. When I…
My Koryto
  • 657
  • 1
  • 4
  • 16
9
votes
2 answers

Rails Upsert PG created_at issue

Sorry if this has been answered before but I can't find a definite answer. Surely someone has come across this issue when using upsert you need to specify every column including created_at and updated_at? How can I not update the created_at…
i cant code
  • 305
  • 2
  • 7
9
votes
2 answers

JSON Parser Error 783: unexpected token at for params

I am editing a resource - @article - and whenever I submit it I get the following error: JSON::ParserError in ArticlesController#update 783: unexpected token at '#' It has highlighted this line: if…
marcamillion
  • 32,933
  • 55
  • 189
  • 380
9
votes
5 answers

Rails model generation fails due to foreign key type

I created a model with the following command: rails g model UserCertification user:references certification:references certification_no:string which is referencing to my devise user model user:references. On the db:migrate I receive the following…
Christian K.
  • 107
  • 1
  • 5
9
votes
2 answers

Rails ActiveStorage: how to avoid one redirect for each image?

If you use ActiveStorage and you have a page with N images you get N additional requests to your Rails app (i.e. N redirects). That means wasting a lot of server resources if you have tens of images on a page. I know that the redirect is useful for…
collimarco
  • 34,231
  • 36
  • 108
  • 142
9
votes
1 answer

How to configure Jasmine in Rails 6?

How do I configure Jasmine in the Rails 6 environment (where Webpack replaces the asset pipeline for Javascript) so I can test the Javascript modules I've written for my app? I installed the jasmine gem, ran rails generate jasmine:install, and…
Zack
  • 6,232
  • 8
  • 38
  • 68
9
votes
2 answers

Rails 6 with Zeitwerk: How to Extend Ruby Core Classes like Date, Time, String etc

I am upgrading a Rails 5.2.2 to Rails 6.0.0 that now has Zeitwerk. Previously I had been extended core ruby classes like Date, Time, String, Float etc as described in this question. Using an initializers file to load all files from the…
Jay Killeen
  • 2,832
  • 6
  • 39
  • 66
9
votes
2 answers

Memory leak after upgrade Rails 5.2 to 6.0.0

Has anyone experienced this? We upgraded a project from Rails 5.2 to Rails 6.0.0 and after this, the memory consumption skyrocketed... In the release candidate environment, it works fine, but in production, the container dies because of the memory…
9
votes
1 answer

Rails 6 - constant ActionController::InvalidAuthenticityToken

I'm tinkering with Rails 6 and I am constantly getting ActionController::InvalidAuthenticityToken on forms generated by rails, such as (implementing the rails tutorial book register/login flow) <%= form_for(@user, url: 'signup') do |f| %> <%=…
9
votes
8 answers

Rails 6: How to add jquery-ui through webpacker?

I'm currently trying to implement a datepicker into my application, the problem is that there is no documentation on how to add the jquery-ui-rails gem through webpacker. Probably there is another way to add gems or another gem that would fit my…
arnasklas
  • 123
  • 1
  • 1
  • 5
9
votes
3 answers

has_many association migration in Rails

I m working on a Rails project (Rails version 4.2.3). I created a User and Task model but did not include any association between them during creation. Now i want one user to have many tasks and one task belonging to one user. Through rails g…
8
votes
3 answers

Rails 6.1.5: uninitialized constant Mail::TestMailer

Why am i getting 'uninitialized constant Mail::TestMailer' error with "Rails 6.1.5 & Ruby 3.1.0" while working without problems "Rails 6.1.5 & Ruby 3.0.1" ?
togi
  • 814
  • 5
  • 13
8
votes
3 answers

Rails 6.1 command webpack not found when precompiling assets in capistrano

I have a capistrano/sshkit problem with rake assets:precompile generating command webpack not found when my capistrano apply_theme task is invoked I have the bin folder checked into source control and I have node version v12.18.1 and yarn version…
jamesc
  • 12,423
  • 15
  • 74
  • 113