hi
maybe its a simple question, but i can't understand how to resolve it.
i have a model user and contact.
so a user can have many contact and contact belong to one user.
so for now i want count the number of contact of the user.
what i did is like this:
count = ActiveRecord::Base.connection.select_one("select
count(person_id) amis from contacts where user_id =" + user.id.to_s)

but i dont like this solutions cause the number of freind i will use
it in a sortable table, and if this variable dont belong to the user
params, i cant use it to sort the table :/
thanks.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to