Archive for November 2007

Display all Rails ActiveRecord Attributes

By accident I just found out that if you type the ActiveRecord model name in your Rails console session (script/console), it prints out all the attributes of your model.
Now more trips to your database, to find out how attributes are named!

Delayed:netmonic schmidp$ script/console
Loading development environment (Rails 1.99.0)
>> XenServer
=> XenServer(id: integer, hostname: string,
created_at: datetime, updated_at: datetime, [...]