Reputation: 4794
I'm currently looking through a system trying to figure out how things work together - I know a couple basic ways to examine objects (I'm in the console), such as Object.methods, but I was wondering if there were ways to find, say, it's attributes, and it's relationships with other models (for example, has_many relationships) and the like.
Upvotes: 0
Views: 234
Reputation: 58324
Sounds like you're referring to specifically an ActiveRecord object. If you look up the documentation on ActiveRecord (e.g., http://api.rubyonrails.org/classes/ActiveRecord/Base.html), you'll find a lot of methods to get some useful info. For example, to see the attributes, you could examine MyActiveRecord.attribute_names.
Upvotes: 0