Adding relation to Activity, eg. has_many comments, Comment belongs_to activity

39 views
Skip to first unread message

Janusz M

unread,
Aug 26, 2016, 6:03:46 AM8/26/16
to Public Activity
I'd like to add 'comments' to activities. So each PublicActivity::Activity could have many comments from different users (Comment belongs_to 'activity').

Is this currently supported by PA gem or should I do something like the method mentioned in earlier topics, eg. extending the PA class with class_eval block ?

Scenarios to consider:

PublicActivity::Activity.class_eval do
  has_many
:comments
 
# or acts_as_commentable
end

or create a new Model that inherits from PublicActivity::Activity, defined associations in the model but also tell it to use the 'activities' table?

class Activity < PublicActivity::Activity
 
self.table_name = "activities"
  has_many
:comments
end


?
Reply all
Reply to author
Forward
0 new messages