Questions tagged [ruby-on-rails-7]
For Ruby on Rails 7 questions: Ruby on Rails 7 is a web app framework in Ruby. Use tags like [ruby-on-rails], [ruby], [rails-7], [activerecord], [actionview], [actioncontroller], [routing], [authentication], [authorization], [database], [testing], [deployment], [gems], [api], etc. Provide specific details and errors.
ruby-on-rails-7
422
questions with no upvoted or accepted answers
8
votes
0
answers
1k
views
Rails 7 import map with javascript package from cdn throwing CORS error
I'm trying to import a JS package hosted on a CDN using the new Rails 7 import maps feature. However, whenever my Rails project loads I get a CORS related error in this form:
Access to script at '...
8
votes
2
answers
8k
views
has_many :through association cannot find a valid model
I am creating association pretty much identical with the Rails Guides Patient-Appointment-Physician data model. A user has many prospects through prospect_subscription. However, when trying to access ...
7
votes
1
answer
2k
views
Import Maps not using precompiled JavaScript assets in pipeline in production environment only (Rails 7)
Anyone managed to wrap their head around importmaps in Rails 7? I have a headscratcher.
If I run ./bin/importmap json in development, I get this (as expected):
{
"imports": {
"...
5
votes
0
answers
966
views
Rails 7 & Active Record - ArgumentError: Unknown key: :source
I am working on a Rails 7 upgrade from Rails 6 and I constantly get an error regarding the source key on active record relationships.
I have multiple places like:
has_many :custom_accounts, through: :...
4
votes
0
answers
789
views
Can't access Rails app in production after Kamal deploy
I'm using Kamal (old MRSK) with Rails and I'm able to run kamal deploy with success.
However, I'm having issues accessing the website in production after deployment: when I access the website URL www....
4
votes
1
answer
451
views
Activeadmin Rails 7 Tailwind Issue
Just install active_admin in rails 7 and ruby 3.1.0
gem 'activeadmin', github: 'activeadmin/activeadmin', branch: 'master'
It add two style files. One is active_admin_old.scss
and other is ...
4
votes
0
answers
1k
views
`FrozenError: can't modify frozen Array` in Rails 7 Engine when running `rspec`
I just upgraded an Engine from Rails 5 to Rails 7. This error started appearing at Rails 6.1.7.6, but I thought perhaps it might've been fixed in Rails 7.
Here's the error I get when I run rspec
An ...
4
votes
0
answers
1k
views
How to scroll to anchor after navigation with Hotwire Turbo Frame?
I would like to have a link inside a turbo frame that works as usual (i.e. by default, when the link is clicked then the frame targets itself to load content provided at the given link url) but with ...
4
votes
0
answers
912
views
Rails 7 No loader is configured for ".coffee" files:
I have an older app I am transitioning to Rails 7. I created a new app and Im essentially putting the gemfiles, controllers, models, and views that I used on the previous app. I keep seeing this error ...
4
votes
2
answers
851
views
How to register service-worker in rails 7 used importmap?
Updated on 1/18/2023 to reflect the answer from Bijan
Facing problem
I want to convert a web application created with Rails 7 that uses importmap into a PWA.
However, I'm having trouble registering ...
4
votes
1
answer
2k
views
Rails 7 using custom js in specific pages
Having adapted the hotwire mechanism for rails 7, problems arise for custom JS that are dependency-less. in this case, a JS that is not mapped to a given source.
Added to importmap.rb:
pin_all_from &...
4
votes
1
answer
720
views
Active Storage _blob partial not being respected or loaded
I am trying to edit app/views/active_storage/blobs/_blob.html.erb, the partial file created when installing active_storage which allows you to customise how blobs appear inside action_text output.
On ...
4
votes
0
answers
1k
views
Using webpack with js_bundling and rails 7
I'm currently building an application using new rails 7 and js_bundling gem with webpack (not webpacker). But I'm having trouble making the javascript work.
I am currently packing all my sources into ...
4
votes
0
answers
3k
views
Rails 7/Production - Are you trying to open an SSL connection to a non-SSL Puma?
I keep getting this error in production mode HTTP parse error, malformed request: #<Puma::HttpParserError: Invalid HTTP format, parsing fails. Are you trying to open an SSL connection to a non-SSL ...
4
votes
1
answer
841
views
Sass built app/builds/application.css not making it into header
I am using the ruby Gem cssbundling-rails and dart-sass to process Sass in a Rails 7 app (and I am fairly new to Rails).
In the package.json file I define the build:css script:
"build:css": &...