Module: OnForm::Types

Defined in:
lib/on_form/types.rb

Defined Under Namespace

Classes: Type

Class Method Summary collapse

Class Method Details

._adapterObject



41
42
43
# File 'lib/on_form/types.rb', line 41

def self._adapter
  @_adapter ||= ActiveRecord::ConnectionAdapters::AbstractAdapter.new(nil)
end

.lookup(type, options) ⇒ Object

for rails 4.2 and below, the type map lives on individual database adapters, but we may not have any models, so here we fall back to the map defined by the abstract adapter class.

Raises:

  • (ArgumentError)


26
27
28
29
# File 'lib/on_form/types.rb', line 26

def self.lookup(type, options)
  default = options.delete(:default)
  Type.new(ActiveRecord::Type.lookup(type, options), default)
end