configures acts_as_votable [#9]
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -34,6 +34,7 @@ gem 'devise'
|
||||
|
||||
gem "responders"
|
||||
gem 'foundation-rails'
|
||||
gem 'acts_as_votable'
|
||||
|
||||
group :development, :test do
|
||||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
||||
|
||||
@@ -36,6 +36,7 @@ GEM
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.3, >= 0.3.4)
|
||||
tzinfo (~> 1.1)
|
||||
acts_as_votable (0.10.0)
|
||||
arel (6.0.2)
|
||||
bcrypt (3.1.10)
|
||||
binding_of_caller (0.7.2)
|
||||
@@ -188,6 +189,7 @@ PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
acts_as_votable
|
||||
byebug
|
||||
capybara
|
||||
coffee-rails (~> 4.1.0)
|
||||
|
||||
22
db/migrate/20150717180105_acts_as_votable_migration.rb
Normal file
22
db/migrate/20150717180105_acts_as_votable_migration.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
class ActsAsVotableMigration < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :votes do |t|
|
||||
|
||||
t.references :votable, :polymorphic => true
|
||||
t.references :voter, :polymorphic => true
|
||||
|
||||
t.boolean :vote_flag
|
||||
t.string :vote_scope
|
||||
t.integer :vote_weight
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :votes, [:voter_id, :voter_type, :vote_scope]
|
||||
add_index :votes, [:votable_id, :votable_type, :vote_scope]
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :votes
|
||||
end
|
||||
end
|
||||
17
db/schema.rb
17
db/schema.rb
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20150716174358) do
|
||||
ActiveRecord::Schema.define(version: 20150717180105) do
|
||||
|
||||
create_table "debates", force: :cascade do |t|
|
||||
t.string "title"
|
||||
@@ -39,4 +39,19 @@ ActiveRecord::Schema.define(version: 20150716174358) do
|
||||
add_index "users", ["email"], name: "index_users_on_email", unique: true
|
||||
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||
|
||||
create_table "votes", force: :cascade do |t|
|
||||
t.integer "votable_id"
|
||||
t.string "votable_type"
|
||||
t.integer "voter_id"
|
||||
t.string "voter_type"
|
||||
t.boolean "vote_flag"
|
||||
t.string "vote_scope"
|
||||
t.integer "vote_weight"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "votes", ["votable_id", "votable_type", "vote_scope"], name: "index_votes_on_votable_id_and_votable_type_and_vote_scope"
|
||||
add_index "votes", ["voter_id", "voter_type", "vote_scope"], name: "index_votes_on_voter_id_and_voter_type_and_vote_scope"
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user