socialforge/app/models/activity.rb

21 lines
601 B
Ruby
Raw Normal View History

class Activity < ActiveRecord::Base
attr_accessible :act_id, :act_type, :user_id
belongs_to :act, :polymorphic => true
belongs_to :user
validates :act_id, presence: true
validates :act_type, presence: true
validates :user_id, presence: true
include Trustie::Cache::ClearCourseEvent
2015-07-16 10:26:09 +08:00
before_create :set_container_type_val
#helper :activities
include ActivitiesHelper
def set_container_type_val
2015-07-17 13:40:53 +08:00
container_type,container_id =get_container_type(self)
self.activity_container_type = container_type
self.activity_container_id = container_id
2015-07-16 10:26:09 +08:00
end
end