favorites and favoritable

40 views
Skip to first unread message

jsh

unread,
May 29, 2014, 3:05:03 PM5/29/14
to communi...@googlegroups.com
Hi, 

I've seen favorites and favoritable in the code. (Post model)

I couldn't find a link on UI for doing so.
is there an example where I can favorite, say a post, and my profile will list all of my favorites?

Thanks.


Bruno Bornsztein

unread,
Jun 2, 2014, 9:06:42 AM6/2/14
to communi...@googlegroups.com
Look in clippings/_favorite.html.haml for an example of how to create a favorite. To list a user's favorites, you just need to query current_user.favorites. For example:

//in your controller
@favorites = current_user.favorites

//in your view, using the favorites/_favorite.html.haml partial
@favorites.each do |favorite|
  =render favorite






--
You received this message because you are subscribed to the Google Groups "CommunityEngine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to communityengi...@googlegroups.com.
To post to this group, send email to communi...@googlegroups.com.
Visit this group at http://groups.google.com/group/communityengine.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages