Sha256: 1690b20dc5daf7f0bea259b5196c6ef0d0edfbcf23f17f1dc9e0322c975a4a26

Contents?: true

Size: 492 Bytes

Versions: 40

Compression:

Stored size: 492 Bytes

Contents

module ActiveRecordSurvey
	# Ensure the instance_node has a value less than the maximum
	class NodeValidation::MaximumValue < NodeValidation
		# Validate the instance_node value is less than the maximum
		def validate_instance_node(instance_node, answer_node = nil)
			is_valid = (!instance_node.value.to_s.empty? && instance_node.value.to_f <= self.value.to_f)

			instance_node.errors[:base] << { :nodes => { answer_node.id => ["MAXIMUM_VALUE"] } } if !is_valid

			is_valid
		end
	end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
active_record_survey-0.1.49 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.48 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.47 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.46 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.45 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.44 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.43 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.42 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.41 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.40 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.39 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.38 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.37 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.36 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.35 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.34 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.32 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.31 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.30 lib/active_record_survey/node_validation/maximum_value.rb
active_record_survey-0.1.29 lib/active_record_survey/node_validation/maximum_value.rb