class Frigate::Form::Property
Uses to define a form property
Attributes
name[RW]
options[RW]
parent[RW]
root[RW]
value[RW]
Public Class Methods
new(name, root, parent, options)
click to toggle source
@param [Symbol] name @param [Hash] options
# File lib/frigate/form/property.rb, line 11 def initialize(name, root, parent, options) @name, @root, @parent, @options = name, root, parent, options set_validations set_custom_validations end
Private Instance Methods
add_error(name)
click to toggle source
# File lib/frigate/form/property.rb, line 33 def add_error(name) errors.add(:value, name) end
Also aliased as: error
set_custom_validations()
click to toggle source
# File lib/frigate/form/property.rb, line 26 def set_custom_validations validations = options.delete(:validate) validations.is_a?(Array) and validations.each do |validation| singleton_class.class_eval { validate &validation } end end
set_validations()
click to toggle source
# File lib/frigate/form/property.rb, line 20 def set_validations validations = options.delete(:validates) singleton_class.class_eval { validates :value, validations } if validations true end