method

table_exists?

table_exists?()
public

Indicates whether the table associated with this class exists

1Note

Use table_exists? in initializers

THAiSi ยท Mar 11, 20092 thanks

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.