Quantcast
Channel: Rails activity feed from a polymorphic following - Stack Overflow
Browsing index pages (4 articles)
↧

Rails activity feed from a polymorphic following

I'm tracking the following tables: Story (id, user_id, content) Vote (id, user_id, story_id) Flag (id, user_id, story_id) etc.. with an activity table: Activity (id, user_id,action, trackable_id,...

View Article


Answer by IBueno for Rails activity feed from a polymorphic following

To solve this, I'd search into Activity using votes and flags id's instead of user id's. Something like this: def get_votes(current_user) stories = current_user.stories votes = Votes.where(story_id:...

View Article


Answer by Sandip Ransing for Rails activity feed from a polymorphic following

I suggest you have following class definitions and associations: # User class User :trackable end # Flag (id, user_id, story_id) class Flag :trackable end # with an activity table: # Activity (id,...

View Article

Answer by Sergey Moiseev for Rails activity feed from a polymorphic following

What about making Activity STI class? class Story < ActiveRecord::Base belongs_to :user end class Activity < ActiveRecord::Base belongs_to :story belongs_to :user end class Vote < Activity def...

View Article
Browsing index pages (4 articles)


Latest Images