Sha256: 6d642ff1a4928c6cd371b7adb80e22782f554bc18025cfa6c4befeb3c9320ca7

Contents?: true

Size: 461 Bytes

Versions: 2

Compression:

Stored size: 461 Bytes

Contents

class Question < ActiveRecord::Base
  has_many :answers, :order => 'answers.position ASC'
  has_many :active_answers, :class_name => 'Answer',
                            :conditions => ["answers.active = ?", true],
                            :order => 'answers.position ASC'
  belongs_to :questionnaire

  validates :details,    :presence => true

  accepts_nested_attributes_for :answers, :reject_if => proc { |attributes| attributes['details'].blank? }
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
survey_says-0.0.2 app/models/question.rb
survey_says-0.0.1 app/models/question.rb