Rake db: migrate uninitialized constant

To run rake db: migrate I need both my models and the constants defined in the application controller.

When I run it, I get this

rake aborted!
An error has occurred, all later migrations canceled:

uninitialized constant Secondsperday

All I need is a rake to load the environment. This used to be done ...

Secondsperday is not a model, its this line in application controller.rb

Secondsperday = 24 * 3_600

Please help, I'm stuck for a week.

+3
source share
1 answer

Migrations do not load the application controller.

If you want constants in the application to define them in a file placed in $ RAILS_ROOT / config / initializers

+2
source

Source: https://habr.com/ru/post/1721435/


All Articles