テーブル情報取得
ActiveRecord::Base.connection.tables
結果
=> ["schema_migrations", "ar_internal_metadata", "contacts"]
列の名前取得
【テーブル名】.column_names
=> ["id", "name", "email", "content"]
列の情報取得
【テーブル名】.columns
結果
=>
[#<ActiveRecord::ConnectionAdapters::PostgreSQL::Column:0x0000000117e5ebc0
@collation=nil,
@comment=nil,
@default=nil,
@default_function="nextval('contacts_id_seq'::regclass)",
@name="id",
@null=false,
@serial=true,