Class: Poncho::Params::ArrayParam

Inherits:
Poncho::Param show all
Defined in:
lib/poncho/params/array.rb

Instance Attribute Summary

Attributes inherited from Poncho::Param

#name, #options

Instance Method Summary collapse

Methods inherited from Poncho::Param

#initialize, type, #type

Constructor Details

This class inherits a constructor from Poncho::Param

Instance Method Details

#convert(value) ⇒ Object



10
11
12
# File 'lib/poncho/params/array.rb', line 10

def convert(value)
  Array(value)
end

#validate_each(record, attribute, value) ⇒ Object



4
5
6
7
8
# File 'lib/poncho/params/array.rb', line 4

def validate_each(record, attribute, value)
  if !value.is_a?(Array)
    record.errors.add(attribute, :invalid_array, options.merge(:value => value))
  end
end