Add token string attribute to Poll Answer
This commit is contained in:
@@ -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 }},
|
||||
|
||||
5
db/migrate/20171006102811_add_token_to_poll_answer.rb
Normal file
5
db/migrate/20171006102811_add_token_to_poll_answer.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddTokenToPollAnswer < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :poll_answers, :token, :string
|
||||
end
|
||||
end
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user