Module: AskIt::ActiveRecord::ClassMethods
- Defined in:
- lib/ask_it/active_record.rb
Instance Method Summary collapse
Instance Method Details
#has_many_surveys ⇒ Object
16 17 18 |
# File 'lib/ask_it/active_record.rb', line 16 def has_many_surveys has_many :surveys, class_name: 'AskIt::Survey' end |
#has_one_survey ⇒ Object
20 21 22 |
# File 'lib/ask_it/active_record.rb', line 20 def has_one_survey has_one :survey, class_name: 'AskIt::Survey' end |
#has_surveys ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/ask_it/active_record.rb', line 8 def has_surveys has_many :survey_attempts, as: :participant, class_name: 'AskIt::Attempt' define_method('for_survey') do |survey| survey_attempts.where(survey_id: survey.id) end end |