In my Padrino App I define model classes that I want to use from a script in bin/
without actually serving something (e.g. pre-populate database with a command line tool).
How can I access the model classes and database? I digged around the padrino console
and tried with
Padrino.mounted_apps.each do |app|
puts "=> Loading Application #{app.app_class}"
app.app_obj.setup_application!
end
but to no avail, I keep getting
bin/gusy_fill:13:in `<main>': uninitialized constant Seminar (NameError)
errors. I start bin/gusy_fill with bundle exec bin/gusy_fill
and Seminar
is the name of a model, referenced like
puts Seminar.all
in bin/gusy_fill
. I have a related question about how to do this from a different gem.