Adding surveys
This commit is contained in:
parent
69a0d12793
commit
335608e6c4
28 changed files with 434 additions and 21 deletions
|
|
@ -34,6 +34,7 @@ class Conference < ActiveRecord::Base
|
|||
has_many :campaigns, dependent: :destroy
|
||||
has_many :commercials, as: :commercialable, dependent: :destroy
|
||||
has_many :subscriptions, dependent: :destroy
|
||||
has_many :surveys, as: :surveyable, dependent: :destroy
|
||||
|
||||
accepts_nested_attributes_for :venue
|
||||
accepts_nested_attributes_for :tickets, allow_destroy: true
|
||||
|
|
|
|||
6
app/models/survey.rb
Normal file
6
app/models/survey.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
class Survey < ActiveRecord::Base
|
||||
belongs_to :surveyable, polymorphic: true
|
||||
has_many :survey_questions
|
||||
|
||||
validates :title, presence: true
|
||||
end
|
||||
10
app/models/survey_question.rb
Normal file
10
app/models/survey_question.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
class SurveyQuestion < ActiveRecord::Base
|
||||
belongs_to :survey
|
||||
|
||||
# Order of this list should not be changed without proper action!
|
||||
enum type: [:boolean, :choice, :string, :text, :datetime, :numeric]
|
||||
|
||||
ICONS = { boolean: 'dot-circle-o', choice: 'check-square-o', string: 'edit', text: 'align-left', datetime: 'clock-o', numeric: 'slack' }
|
||||
|
||||
validates :title, presence: true
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue