Saturday, February 25, 2012

[Rails] Display associated record count

Hi all,

I have a website which has users and each user can creat multiple
product records. I have the ability to show the associated records under
the user profile but what I want to do now is on the user index, to
display a number representing how many products that user has up for
sale. So basically to count all the records for each user and display on
the index so that it would look like the following e.g.

Username Favourite Console Games available to trade
jimmypop01 Playstation 3 0
andypandy Playstation 3 3
GoogleMail Playstation 3 2

I was wondering if anyone knows how I would go about doing this.

All I have managed so far is to display how many records are in that
table.

So that people know I have two separate tables for users and games.

Thanks
Christopher Jones

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate