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
964
questions
1
vote
0
answers
27
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
68
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
66
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
27
views
Uncaught TypeError: Failed to resolve module specifier "application". Relative references must start with either "/", "./", or "../"
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
78
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
69
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 ...
0
votes
0
answers
39
views
Debugging tailwindcss:watch in Procfile.dev in Docker
I am trying to build a development compose.yaml to mimic what I hope to be my production deployment. Currently it looks like the following using bin/dev.
services:
web:
build:
context: ./
...
0
votes
0
answers
68
views
Use custom fonts Rails 7 with jsbundling (esbuild)
How to properly use custom fonts in Rails 7 with jsbundling? I'm trying to use Fontawesome-Free and Font Lora, but I'm getting a loader error.
13:46:30 web.1 | ActionController::RoutingError (No ...
1
vote
1
answer
44
views
Rails 7.1 Stack level too deep in partials and simpleform
After upgrading our rails stack from 7.0 to 7.1 i noticed these weird errors of stack level too deep even without much of a stack trace. It happens as far as i noticed, only whenever i have a simple ...
1
vote
1
answer
25
views
Sprockets::Rails::Helper::AssetNotPrecompiledError in MyEngine::Frontend#new
Asset hero_banner.jpg was not declared to be precompiled in production.
Declare links to your assets in app/assets/config/manifest.js.
//= link hero_banner.jpg
Rails.application.config.assets.paths &...
1
vote
2
answers
66
views
error trying to import module pinned in import map
I have a rails 7 app and I'm trying to add hotwire functionality. I am getting an error with pinning stimulus and importing it in application.js
importmap.rb
pin "application"
pin "@...
0
votes
0
answers
45
views
javascript_importmap_tags is creating a link to "application.js" with error
I am working on adding javascript handling to a rails 7 app. I want to use import maps to import external libraries for turbo and stimulus. The current issue I'm having trouble with is that ...
1
vote
1
answer
92
views
JS file is blocked due to bad MIME in production
In my Rails 7 project I have been using importmap for importing JS modules. here is the config:
# config/importmap
pin "application", preload: true
pin "@hotwired/turbo-rails", to:...
1
vote
1
answer
32
views
Rails controller doesn’t render any templates
I have a question about a rails 7 project I’m starting. I have a controller HomeController with one action home.
class HomeController < ApplicationController
def home
render
end
end
I have ...
0
votes
1
answer
14
views
Is there any way to set individual session timeouts using cookie_store in Rails 7 + Devise, or do I have to use a active_record_store approach?
I'm using Devise with Rails 7.1.3. I'm trying to implement a user configurable timeout value for session expiration, so for example Alice could set her expiration time to 12 hours and Bob could set ...