Custom Class Finders
When Formtastic needs to find a handler for an input type (like :string
), it uses a Class Finder.
This object maps :string
into a class name StringInput
and tries to find it in a namespace like Formtastic::Inputs
. You can customize this, by creating own ClassFinder that changes the class name or the namespace. For example you can have MyClassFinder
that will for :string
look up MyNamespace::MyStringInput
.
This is useful for plugin authors like activeadmin and formtastic-bootstrap that have custom inputs in own namespace.
The default class finders are InputClassFinder and ActionClassFinder. Both look up the class name in all namespaced, configured in Formtastic::FormBuilder.input_namespaces
and Formtastic::FormBuilder.action_namespaces
settings.