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. 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jan 6, 9:57 pm, jmcguckin <mcguc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jan 6, 9:57 pm, jmcguckin <mcguc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.