个人动态表重构

This commit is contained in:
sw 2015-08-25 17:54:29 +08:00
parent 30147c29ee
commit ffe40b399d
3 changed files with 8 additions and 8 deletions

View File

@ -15,8 +15,8 @@ class CourseActivity < ActiveRecord::Base
user_activity.save user_activity.save
else else
user_activity = UserActivity.new user_activity = UserActivity.new
user_activity.act_id = self.id user_activity.act_id = self.course_act_id
user_activity.act_type = self.class.to_s user_activity.act_type = self.course_act_type
user_activity.container_type = "Course" user_activity.container_type = "Course"
user_activity.container_id = self.course_id user_activity.container_id = self.course_id
user_activity.save user_activity.save

View File

@ -30,8 +30,8 @@ class ForgeActivity < ActiveRecord::Base
user_activity.save user_activity.save
else else
user_activity = UserActivity.new user_activity = UserActivity.new
user_activity.act_id = self.id user_activity.act_id = self.forge_act_id
user_activity.act_type = self.class.to_s user_activity.act_type = self.forge_act_type
user_activity.container_type = "Project" user_activity.container_type = "Project"
user_activity.container_id = self.project_id user_activity.container_id = self.project_id
user_activity.save user_activity.save

View File

@ -5,8 +5,8 @@ class AboutUserActivities < ActiveRecord::Migration
for i in 1 ... forge_count do i for i in 1 ... forge_count do i
ForgeActivity.page(i).per(30).each do |activity| ForgeActivity.page(i).per(30).each do |activity|
user_activity = UserActivity.new user_activity = UserActivity.new
user_activity.act_id = activity.id user_activity.act_id = activity.forge_act_id
user_activity.act_type = activity.class.to_s user_activity.act_type = activity.forge_act_type
user_activity.container_type = "Project" user_activity.container_type = "Project"
user_activity.container_id = activity.project_id user_activity.container_id = activity.project_id
user_activity.created_at = activity.created_at user_activity.created_at = activity.created_at
@ -20,8 +20,8 @@ class AboutUserActivities < ActiveRecord::Migration
for i in 1 ... course_count do i for i in 1 ... course_count do i
CourseActivity.page(i).per(30).each do |activity| CourseActivity.page(i).per(30).each do |activity|
user_activity = UserActivity.new user_activity = UserActivity.new
user_activity.act_id = activity.id user_activity.act_id = activity.course_act_id
user_activity.act_type = activity.class.to_s user_activity.act_type = activity.course_act_type
user_activity.container_type = "Course" user_activity.container_type = "Course"
user_activity.container_id = activity.course_id user_activity.container_id = activity.course_id
user_activity.created_at = activity.created_at user_activity.created_at = activity.created_at