You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
689 B
25 lines
689 B
6 years ago
|
class Activity < ActiveRecord::Base
|
||
|
attr_accessible :act_id, :act_type, :user_id
|
||
|
belongs_to :act, :polymorphic => true
|
||
|
belongs_to :user
|
||
|
belongs_to :activity_container, polymorphic: true
|
||
|
validates :act_id, presence: true
|
||
|
validates :act_type, presence: true
|
||
|
validates :user_id, presence: true
|
||
|
|
||
|
include Trustie::Cache::ClearCourseEvent
|
||
|
|
||
|
before_create :set_container_type_val
|
||
|
|
||
|
#helper :activities
|
||
|
include ActivitiesHelper
|
||
|
def set_container_type_val
|
||
|
params =get_container_type(self)
|
||
|
self.activity_container_type = params[0]
|
||
|
self.activity_container_id = params[1]
|
||
|
if(self.act_type == 'JournalsForMessage')
|
||
|
self.user_id = params[2]
|
||
|
end
|
||
|
end
|
||
|
end
|