I’m using an initializer script in config/intializers/my_script.rb to
initialize the database through an xml configuration file. I’m using
JAXB to create the xml bindings and unmarshal the xml information.
Everything was working fine until I decided that I wanted to drop my
table and re-run my migrations. It looks like Rails tries to load the
intializer scripts before any migrations are run… And its awfully hard
to populate a non-existent database. Some might even say, its “nigh
So, my question is, does anyone know of a better way to initialize a
database using an xml file and Active Record on startup, without
conflicting with rails db migrations?..
Currently, I have a simple “if” expression in my initializer script now,
that I can toggle on and off… for db migrations and rollbacks, but
that just seems cheezy. Curious to hear your thoughts and