method
table_exists?
v3.0.0 -
Show latest stable
- Class:
ActiveRecord::Base
table_exists?()public
Indicates whether the table associated with this class exists
1Note
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.