You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the Rails Admin's configuration file config/initializers/rails_admin.rb have config.model entry in it,
this rails application tries to access to the database when executing bin/rails assets:precomplie command.
(If no any config.model entries, it won't access to the database at all.)
So if there is no DB available, it fails to precompile. This is the output:
$ bin/rails assets:precompile
rails aborted!
ActiveRecord::ConnectionNotEstablished: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
/home/yuta/src/private/rails/rails-admin-eval/config/initializers/rails_admin.rb:43:in `block in <main>'
/home/yuta/src/private/rails/rails-admin-eval/config/environment.rb:5:in `<main>'
Caused by:
PG::ConnectionBad: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
/home/yuta/src/private/rails/rails-admin-eval/config/initializers/rails_admin.rb:43:in `block in <main>'
/home/yuta/src/private/rails/rails-admin-eval/config/environment.rb:5:in `<main>'
Tasks: TOP => environment
(See full trace by running task with --trace)
Reproduction steps
Create a new Rails application with PostgreSQL database and create a model.
Install and setup Rails Admin following the installation process written on the README.
bin/rails s to confirm that Rails Admin works nicely.
Stop PostgreSQL server.
Confirm bin/rails assets:precompile works.
Add some config.model block to config/initializers/rails_admin.rb like following:
RailsAdmin.config do |config|
...
config.model "ModelYouHaveCreated" do
visible true
end
end
Confirm bin/rails assets:precompile fails.
Expected behavior
Asset precompile process completes without accessing to the DB, because Rails Admin 2.2.1 didn't access to the DB even in the same conditions.
(This behavior on 3.0.0.rc would cause a problem for my application's deployment process, which should be done on CI without DB.)
Additional context
pg 1.3.1
rails 6.1.4.6
rails_admin 3.0.0.beta2, 3.0.0.rc and current master (3d7f3b3), with config.asset_source = :webpacker in config/initializers/rails_admin.rb
webpacker 5.4.3
and with PostgreSQL 13 for DB
(* Sorry but I haven't checked if this behavior occurs with other databases like MySQL or not.)
The text was updated successfully, but these errors were encountered:
This looks to have been caused by e4ae669 - in particular, the RailsAdmin::Config.initialize! from the after_initialize hook (which sets up configured models)
Describe the bug
If the Rails Admin's configuration file
config/initializers/rails_admin.rb
haveconfig.model
entry in it,this rails application tries to access to the database when executing
bin/rails assets:precomplie
command.(If no any
config.model
entries, it won't access to the database at all.)So if there is no DB available, it fails to precompile. This is the output:
Reproduction steps
bin/rails s
to confirm that Rails Admin works nicely.bin/rails assets:precompile
works.config.model
block toconfig/initializers/rails_admin.rb
like following:bin/rails assets:precompile
fails.Expected behavior
Asset precompile process completes without accessing to the DB, because Rails Admin 2.2.1 didn't access to the DB even in the same conditions.
(This behavior on 3.0.0.rc would cause a problem for my application's deployment process, which should be done on CI without DB.)
Additional context
pg 1.3.1
rails 6.1.4.6
rails_admin 3.0.0.beta2, 3.0.0.rc and current master (3d7f3b3), with
config.asset_source = :webpacker
inconfig/initializers/rails_admin.rb
webpacker 5.4.3
and with PostgreSQL 13 for DB
(* Sorry but I haven't checked if this behavior occurs with other databases like MySQL or not.)
The text was updated successfully, but these errors were encountered: