Add token string attribute to Poll Answer

This commit is contained in:
Bertocq
2017-10-06 14:28:57 +02:00
parent 6e29b6adf5
commit 1806bd3df4
3 changed files with 9 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ class Poll::Answer < ActiveRecord::Base
validates :question, presence: true
validates :author, presence: true
validates :answer, presence: true
validates :token, presence: true
# temporary skipping validation, review when removing valid_answers
# validates :answer, inclusion: { in: ->(a) { a.question.valid_answers }},

View File

@@ -0,0 +1,5 @@
class AddTokenToPollAnswer < ActiveRecord::Migration
def change
add_column :poll_answers, :token, :string
end
end

View File

@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20171004151553) do
ActiveRecord::Schema.define(version: 20171006102811) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -592,6 +592,7 @@ ActiveRecord::Schema.define(version: 20171004151553) do
t.string "answer"
t.datetime "created_at"
t.datetime "updated_at"
t.string "token"
end
add_index "poll_answers", ["author_id"], name: "index_poll_answers_on_author_id", using: :btree