Sha256: c7a80f957002a341df9734f4c94c431108f7de9e70cd202a0db8cc3cb53a7176
Contents?: true
Size: 948 Bytes
Versions: 10
Compression:
Stored size: 948 Bytes
Contents
module Surveyor module Models module QuestionGroupMethods def self.included(base) # Associations base.send :has_many, :questions base.send :has_one, :dependency end # Instance Methods def initialize(*args) super(*args) default_args end def default_args self.display_type ||= "inline" end def renderer display_type.blank? ? :default : display_type.to_sym end def display_type=(val) write_attribute(:display_type, val.nil? ? nil : val.to_s) end def dependent? self.dependency != nil end def triggered?(response_set) dependent? ? self.dependency.is_met?(response_set) : true end def css_class(response_set) [(dependent? ? "g_dependent" : nil), (triggered?(response_set) ? nil : "g_hidden"), custom_class].compact.join(" ") end end end end
Version data entries
10 entries across 10 versions & 1 rubygems