Sha256: 74d55ce1c1afee5e0bfbf9e4d470b75e4fbbf66fa621706095fddf38a4cf2ec6
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
module Surveyor module Models module SurveySectionMethods def self.included(base) # Associations base.send :has_many, :questions, :order => "display_order ASC", :dependent => :destroy base.send :belongs_to, :survey # Scopes base.send :default_scope, :order => "display_order ASC" base.send :scope, :with_includes, { :include => {:questions => [:answers, :question_group, {:dependency => :dependency_conditions}]}} @@validations_already_included ||= nil unless @@validations_already_included # Validations base.send :validates_presence_of, :title, :display_order # this causes issues with building and saving #, :survey @@validations_already_included = true end end # Instance Methods def initialize(*args) super(*args) default_args end def default_args self.data_export_identifier ||= Surveyor::Common.normalize(title) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
surveyor-0.21.0 | lib/surveyor/models/survey_section_methods.rb |