Retrieving Rails Model Column Names
When one 开发者_JAVA技巧retrieves a Rails model object, how are the column (or object attribute) names accessed?
User.column_names
Like a lot of things in Rails, it just works :)
Example:
user = User.find(1)
p user.attributes.keys
精彩评论