You are correct!
ruby-1.9.2-p0 > Corp.tag_counts[0].attributes
=> {"count"=>"19", "id"=>1, "name"=>"law"}
Thanks!!
Joe
On Jan 6, 3:27 pm, Frederick Cheung <[email protected]>
wrote:
> On Jan 6, 9:57 pm, jmcguckin <[email protected]> wrote:
>
> > tag_counts doesn't seem to be working correctly.
>
> > Ruby 1.9.2, Rails 2.3.5
>
> > # From script/console
>
> > ruby-1.9.2-p0 > Corp.tag_counts
> > => [#<Tag id: 1, name: "law">, #<Tag id: 6, name: "vc">]
>
> > According to the documentation, I would expect to see a hash of tag-
> > name vs. counts entries.
>
> Actually i think it looks like what you are supposed to get back are
> tag objects, but with an extra attribute (a count of the number of
> occurences). The default inspects method for AR objects doesn't print
> extra attributes, but they're their all the same (call .attributes to
> see all that attributes an active record object has)
>
> Fred
>
>
>
>
>
> > Joe
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.