diff --git a/app/models/user_score_details.rb b/app/models/user_score_details.rb new file mode 100644 index 00000000..61d5d098 --- /dev/null +++ b/app/models/user_score_details.rb @@ -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 diff --git a/db/migrate/20140617013146_create_user_score_details.rb b/db/migrate/20140617013146_create_user_score_details.rb new file mode 100644 index 00000000..e830e3e0 --- /dev/null +++ b/db/migrate/20140617013146_create_user_score_details.rb @@ -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 diff --git a/test/fixtures/user_score_details.yml b/test/fixtures/user_score_details.yml new file mode 100644 index 00000000..ac8da802 --- /dev/null +++ b/test/fixtures/user_score_details.yml @@ -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 diff --git a/test/unit/user_score_details_test.rb b/test/unit/user_score_details_test.rb new file mode 100644 index 00000000..657a9c2f --- /dev/null +++ b/test/unit/user_score_details_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserScoreDetailsTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end