Added Submission model
This commit is contained in:
parent
5ca234c8fc
commit
933e14673c
9 changed files with 49 additions and 31 deletions
|
|
@ -1,6 +1,7 @@
|
|||
class Survey < ActiveRecord::Base
|
||||
belongs_to :surveyable, polymorphic: true
|
||||
has_many :survey_questions
|
||||
has_many :survey_submissions
|
||||
|
||||
enum target: [:after_conference, :during_registration]
|
||||
validates :title, presence: true
|
||||
|
|
|
|||
7
app/models/survey_submission.rb
Normal file
7
app/models/survey_submission.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
class SurveySubmission < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
belongs_to :survey
|
||||
has_many :survey_replies, through: :user
|
||||
|
||||
accepts_nested_attributes_for :survey_replies
|
||||
end
|
||||
|
|
@ -43,6 +43,7 @@ class User < ActiveRecord::Base
|
|||
has_many :voted_events, through: :votes, source: :events
|
||||
has_many :subscriptions, dependent: :destroy
|
||||
has_many :survey_replies
|
||||
has_many :survey_submissions
|
||||
accepts_nested_attributes_for :roles
|
||||
|
||||
scope :admin, -> { where(is_admin: true) }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue