Class: ActiveInteraction::ModelFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/active_interaction/filters/model_filter.rb

Instance Attribute Summary

Attributes inherited from Filter

#filters, #name, #options

Instance Method Summary collapse

Methods inherited from Filter

#clean, #database_column_type, #default, #default?, #desc, factory, #initialize

Constructor Details

This class inherits a constructor from ActiveInteraction::Filter

Instance Method Details

#cast(value, reconstantize = true) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/active_interaction/filters/model_filter.rb', line 23

def cast(value, reconstantize = true)
  @klass ||= klass

  if matches?(value)
    value
  else
    return super(value) unless reconstantize

    @klass = klass
    cast(value, false)
  end
end