Added target for surveys.

This commit is contained in:
Shyukri Shyukriev 2016-06-30 12:09:21 +02:00
parent 157a16d8f2
commit 9ce4ba6f6b
6 changed files with 12 additions and 15 deletions

View file

@ -36,7 +36,7 @@ class Conference < ActiveRecord::Base
has_many :subscriptions, dependent: :destroy
has_many :surveys, as: :surveyable, dependent: :destroy do
def for_registration
where(target: targets[:registration])
where(target: targets[:during_registration])
end
end

View file

@ -2,7 +2,6 @@ class Survey < ActiveRecord::Base
belongs_to :surveyable, polymorphic: true
has_many :survey_questions
enum target: [:conference, :registration]
enum target: [:after_conference, :during_registration]
validates :title, presence: true
end