views:

45

answers:

1

I'm in the console, looking at someone else's app. I come across the following:

>> p.location
=> [#<Tag id: 2, name: "projects">]

Why do I see this result, which seems to be the object name, and how do I access the actual attribute name, "projects"?

>> p.location.name
=> "Tag"

Thank you very much!

+5  A: 
p.location[0].name
## OR
p.location.first.name

p.location is an array of one element

zed_0xff
Thanks! I am dumb.
Veep
@Veep, you are just new to Rails. Also, if this answered your question, feel free to mark it as answered to that future people might find this to be a useful solution to their problem.
DJTripleThreat