Ruby on Rails / Rubygems / FullStack / Git / Mac notes.
Rails Console Tips: Table Operations
In rails console, you can
list tables
1
>ActiveRecord::Base.connection.tables
list a table structure (but it is a protected method)
123456
# this dose not work. >ActiveRecord::Base.connection.table_structure("projects")# we should utilize send method to call protected method>@c=ActiveRecord::Base.connection>@c.send(:table_structure,"xxxs")# xxxs is your model name