Class: CreateAnswers

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/surveyor/templates/db/migrate/create_answers.rb

Class Method Summary collapse

Class Method Details

.downObject



35
36
37
# File 'lib/generators/surveyor/templates/db/migrate/create_answers.rb', line 35

def self.down
  drop_table :answers
end

.upObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/generators/surveyor/templates/db/migrate/create_answers.rb', line 3

def self.up
  create_table :answers do |t|
    # Context
    t.integer :question_id

    # Content
    t.text :text
    t.text :short_text #Used for presenting responses to experts (ie non-survey takers). Just a shorted version of the string
    t.text :help_text
    t.integer :weight # Used to assign a weight to an answer object (used for computing surveys that have numerical results) (I added this to support the Urology questionnaire -BLC)
    t.string :response_class # What kind of additional data does this answer accept?

    # Reference
    t.string :reference_identifier # from paper
    t.string :data_export_identifier # data export
    t.string :common_namespace # maping to a common vocab
    t.string :common_identifier # maping to a common vocab

    # Display
    t.integer :display_order
    t.boolean :is_exclusive # If set it causes some UI trigger to remove (and disable) all the other answer choices selected for a question (needed for the WHR)
    t.boolean :hide_label
    t.integer :display_length # if smaller than answer.length the html input length will be this value

    t.string :custom_class
    t.string :custom_renderer

    t.timestamps

  end
end