method
table_exists?
Register or
log in
to add new notes.
THAiSi -
March 11, 2009
2 thanks
Use table_exists? in initializers
When using ActiveRecords in initializers, eg. for creating small constant data on startup, use table_exists? for those statements.
the initalizers are also called for migrations, etc, and if you are installing a new instance of the project these initializers will fail the migration to create those tables in the first place.