Ruby on Rails Monday, June 30, 2014

Colin Law wrote in post #1151111:

> If you iterate through the blogs then for each blog
> visits_count = blog.visits.count

Thanks, its works!

But now I have added "liked" column to a visits-table:

Visits (id, user_id, blog_id, page_id, liked)

Default value is false but if user click "like"-link on a page its come
to true.

But how can I count all likes?

page_likes_count = page.visits.liked.count Does not seem to work...

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c8008f0e34783e3a3481c37fab077f38%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment