补充user_score_details Model及数据迁移文件

This commit is contained in:
z9hang 2014-06-17 15:59:34 +08:00
parent da3aa7b291
commit ab486aa811
4 changed files with 57 additions and 0 deletions

View File

@ -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

View File

@ -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

27
test/fixtures/user_score_details.yml vendored Normal file
View File

@ -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

View File

@ -0,0 +1,7 @@
require 'test_helper'
class UserScoreDetailsTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end