parent
559cd103f9
commit
819ff49c63
@ -0,0 +1,13 @@
|
||||
class SchoolQuestion < ApplicationRecord
|
||||
|
||||
belongs_to :school
|
||||
belongs_to :question
|
||||
belongs_to :school_category
|
||||
|
||||
validates_associated :school
|
||||
validates_associated :question
|
||||
validates_associated :school_category
|
||||
|
||||
scope :for, -> (school, question) { where(school_id: school.id, question_id: question.id) }
|
||||
|
||||
end
|
||||
@ -0,0 +1,18 @@
|
||||
class AddSchoolQuestions < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
create_table :school_questions do |t|
|
||||
t.integer :school_id
|
||||
t.integer :question_id
|
||||
t.integer :school_category_id
|
||||
t.integer :attempt_count
|
||||
t.integer :response_count
|
||||
t.float :response_rate
|
||||
t.string :year
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_column :school_categories, :valid_child_count, :integer
|
||||
add_column :school_categories, :response_rate, :integer
|
||||
end
|
||||
end
|
||||
Loading…
Reference in new issue