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
970
questions
0
votes
0
answers
17
views
Rails 7 with turbo - some requests on Chrome/FF doesn't work correctly
It happens only on Chrome/Firefox - on Safari everything works fine.
I noticed that some requests (eg. file upload) don't work correctly after moving to turbo (from turbolinks). Request:
patch https://...
0
votes
0
answers
28
views
Upgrading ruby version from 3.0.0 to 3.1.0 is throwing uninitialised constant Time::RFC2822_DAY_NAME error
Current Rails app has ruby 3.0.0 and trying to upgrade to ruby 3.1.0.
It's breaking with
uninitialised constant Time::RFC2822_DAY_NAM
error where it was previously working properly.
That line is ...
0
votes
1
answer
15
views
Apartment Gem + Rails 7
I'm trying to install apartment gem but its giving error.
When I do
bundle exec rails generate apartment:install
it produce error
undefined method `new' for "Apartment::Reloader":String (...
0
votes
0
answers
34
views
Rails 7.1 redirect_to(Shibboleth Logout) is not working
I am not sure how to debug Rails 7.1, redirect_to() not working vs in Rails 3.2 the same exact code works.
Working Example
Within Rails 3.2, I have a Controller action "logout" that contains ...
0
votes
1
answer
86
views
Rails 7 error during application start - Zeitwerk-related errors
I'm upgrading my rails app from 6.1 to 7.0 and i'm running into this runtime error:
I do use the Authlogic gem, but the odd thing is i have no config/initializers file for Authlogic, and i can't find ...
0
votes
0
answers
75
views
Ruby (3.3.4) and Rails (7.1) - rails s Zeitwerk - uninitialized constant Utils::ScriptsUtils::Utils (NameError)
I am trying to update my ruby app from ruby 2.6.6 to ruby 3.3.4 and Rail 5.1 to Rails 7.1
I know it is not a good practice to do so, but in my case (which is a bit complicated) I felt I didn't have ...
1
vote
0
answers
32
views
Rails 7.1 Turbo stream not working on localhost, but works when deployed to Heroku
I have a very simple Rails 7.1.3.4 app that is essentially a dashboard, where it uses Turbo Streams to display model attributes in real-time. When I deploy my app to Heroku, everything works as ...
0
votes
0
answers
30
views
localhost:3000 not working when I start a docker container for my Rails project
I was following a tutorial on how to Dockerize a brand new Rails 7 app. I made the Docker container 'distant-mirror' Setting up the Docker container took about two hours, but now I entered in my ...
0
votes
0
answers
47
views
How to delete cookies in Rails 7.1?
I recently upgraded my Rails app from version 7.0.4.3 to version 7.1.3.4 and cookies.delete stopped working.
I'm setting a cookie in JavaScript with:
document.cookie = `last_guess=value; path=/`;
...
1
vote
0
answers
36
views
Failed to resolve module specifier "application" .Unable to load the application.js file in rails engine
Uncaught TypeError: Failed to resolve module specifier "application". Relative references must start with either "/", "./", or "../".
In rails 7 while creating ...
1
vote
1
answer
84
views
ActiveRecord::NotNullViolation: RuntimeError: NOT NULL constraint failed: drives.created_at
I am using latest ruby 3.3.3 and latest rails 7.1.3.4.
I am new to rails and I am learning it. Sorry if my request seems dumb to some.
I got this error when I run tests.
It seems that ActiveRecord is ...
0
votes
1
answer
74
views
Rails 7: Psql trying to connect to the wrong database but trying to create correct database
In production mode, I am testing connecting a rails 7 project to a remote server for the postgresql database. However when I try to connect to it, it starts looking to connect to the postgres database ...
0
votes
0
answers
38
views
How do you make Javascript work in rails engine?
I have added these gems in Gemfile
gem "sprockets-rails"
gem "importmap-rails"
gem 'stimulus-rails', '~> 1.2', '>= 1.2.1'
gem 'hotwire-rails', '~> 0.1.0'
gem 'turbo-rails',...
1
vote
1
answer
86
views
Paste multi lines in Rails console with pry
Problem: I cannot paste multi-line code as pry tries to execute every line.
Expected behavior:
[1] pry(main)> %w[a b c]
.map(&:to_sym)
=> [:a, :b, :c]
[2] pry(main)>
Actual behavior:
[1] ...
2
votes
1
answer
73
views
Why would `has_secure_password` suppress password validation on update, but only if the object is newly created?
Let's say I have a simple model like so with a presence validation on the password field.
class User < ApplicationRecord
validates :password, presence: true
end
If I try to update the password ...