Sha256: 0165acae23492c8dc9be8235e2494934607b4dd56e9bd53e71b001ec56d74cc6
Contents?: true
Size: 943 Bytes
Versions: 6
Compression:
Stored size: 943 Bytes
Contents
module SurveyorGui module Models module AnswerMethods def self.included(base) base.send :belongs_to, :question base.send :has_many, :responses base.send :belongs_to, :column base.send :default_scope, lambda { base.order('display_order') } base.send :attr_accessible, :text, :response_class, :display_order, :original_choice, :hide_label, :question_id, :display_type, :is_comment, :column if defined? ActiveModel::MassAssignmentSecurity base.send :scope, :is_not_comment, -> { base.where(is_comment: false) } base.send :scope, :is_comment, -> { base.where(is_comment: true) } end def split_or_hidden_text(part = nil) #return "" if hide_label.to_s == "true" return "" if display_type.to_s == "hidden_label" part == :pre ? text.split("|",2)[0] : (part == :post ? text.split("|",2)[1] : text) end end end end
Version data entries
6 entries across 6 versions & 2 rubygems