补充user_score_details Model及数据迁移文件
This commit is contained in:
parent
da3aa7b291
commit
ab486aa811
|
@ -0,0 +1,4 @@
|
||||||
|
class UserScoreDetails < ActiveRecord::Base
|
||||||
|
attr_accessible :current_user_id, :current_user_level, :new_score, :old_score, :score_action, :score_changeable_obj_id, :score_changeable_obj_type, :score_type, :target_user_id, :target_user_level, :user_id
|
||||||
|
belongs_to :score_changeable_obj,:polymorphic => true
|
||||||
|
end
|
|
@ -0,0 +1,19 @@
|
||||||
|
class CreateUserScoreDetails < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :user_score_details do |t|
|
||||||
|
t.integer :current_user_id
|
||||||
|
t.integer :target_user_id
|
||||||
|
t.string :score_type
|
||||||
|
t.string :score_action
|
||||||
|
t.integer :user_id
|
||||||
|
t.integer :old_score
|
||||||
|
t.integer :new_score
|
||||||
|
t.integer :current_user_level
|
||||||
|
t.integer :target_user_level
|
||||||
|
t.integer :score_changeable_obj_id
|
||||||
|
t.string :score_changeable_obj_type
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,27 @@
|
||||||
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
current_user_id: 1
|
||||||
|
target_user_id: 1
|
||||||
|
score_type: MyString
|
||||||
|
score_action: MyString
|
||||||
|
user_id: 1
|
||||||
|
old_score: 1
|
||||||
|
new_score: 1
|
||||||
|
current_user_level: 1
|
||||||
|
target_user_level: 1
|
||||||
|
score_changeable_obj_id: 1
|
||||||
|
score_changeable_obj_type: MyString
|
||||||
|
|
||||||
|
two:
|
||||||
|
current_user_id: 1
|
||||||
|
target_user_id: 1
|
||||||
|
score_type: MyString
|
||||||
|
score_action: MyString
|
||||||
|
user_id: 1
|
||||||
|
old_score: 1
|
||||||
|
new_score: 1
|
||||||
|
current_user_level: 1
|
||||||
|
target_user_level: 1
|
||||||
|
score_changeable_obj_id: 1
|
||||||
|
score_changeable_obj_type: MyString
|
|
@ -0,0 +1,7 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class UserScoreDetailsTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
Loading…
Reference in New Issue