Class: Poncho::Params::ObjectParam

Inherits:
Poncho::Param show all
Defined in:
lib/poncho/params/object.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/object.rb', line 10

def convert(value)
  value
end

#validate_each(record, attribute, value) ⇒ Object



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

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