31 lines
849 B
Ruby
31 lines
849 B
Ruby
# == Schema Information
|
|
#
|
|
# Table name: questions
|
|
#
|
|
# id :integer not null, primary key
|
|
# answer_kind :integer not null
|
|
# data :text
|
|
# public_asset_path :string
|
|
# question_kind :integer default("simple"), not null
|
|
# text :text not null
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
# section_id :integer not null
|
|
#
|
|
# Indexes
|
|
#
|
|
# index_questions_on_section_id (section_id)
|
|
#
|
|
# Foreign Keys
|
|
#
|
|
# section_id (section_id => sections.id)
|
|
#
|
|
class Question < ApplicationRecord
|
|
enum :answer_kind, { simple: 0, image: 1, politicians: 2 }, prefix: true
|
|
enum :question_kind, { simple: 0, video: 1 }, prefix: true
|
|
|
|
belongs_to :section
|
|
has_one :answer
|
|
|
|
serialize :data, coder: JSON
|
|
end
|