Sha256: b86b5f485a38b9aff2cc51abd8f5845233d9f4614bbe7e1176f9dbcdae1cf1a0

Contents?: true

Size: 301 Bytes

Versions: 5

Compression:

Stored size: 301 Bytes

Contents

module ActiveRecordSurvey
	# Boolean answers can have values 0|1
	class Node::Answer::Boolean < Node::Answer
		# Only boolean values
		def validate_instance_node(instance_node)
			# super - all validations on this node pass
			super &&
			!instance_node.value.to_s.match(/^[0|1]$/).nil?
		end
	end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_record_survey-0.1.5 lib/active_record_survey/node/answer/boolean.rb
active_record_survey-0.1.4 lib/active_record_survey/node/answer/boolean.rb
active_record_survey-0.1.3 lib/active_record_survey/node/answer/boolean.rb
active_record_survey-0.1.2 lib/active_record_survey/node/answer/boolean.rb
active_record_survey-0.1.1 lib/active_record_survey/node/answer/boolean.rb