As long as your migrations were already executed and the table for the model in question already exists, I believe you will be able to call your model from the initializer file as usual: Model.method()
.
If you want to check if the table exists, you could do like this:
if ActiveRecord::Base.connection.table_exists? :settings
Model.method()
end
Finally, if you want to make sure all other initializers have run before running this one, you could add the following code to your initializer:
# config/initializers/rack_attack.rb
Rails.configuration.after_initialize do
Model.method()
end
CLICK HERE to find out more related problems solutions.