I am trying to set up a filter form, in which I can select users based
on User attributes and get a count of the user's post filtered on Post
attributes

this generated query runs very well,

SELECT DISTINCT `users`.* FROM `users` LEFT OUTER JOIN `posts` ON
`posts`.`user_id` = `users`.`id` WHERE (`posts`.`title` LIKE '%pa%')
ORDER BY `users`.`last_name` ASC

and I can display all selected users info :
%tr
%td= user.id
%td= user.first_name
%td= user.last_name
%td= user.email

but how can I add a column with the number of filtered posts for each
user ?

thanks for your feedback [using Rails 3.2.3 )

--
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.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedApr 19, '12 at 3:57p
activeApr 19, '12 at 3:57p
posts1
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Erwin: 1 post

People

Translate

site design / logo © 2021 Grokbase