Module: Reform::Form::ModelReflections

Defined in:
lib/reform/form/model_reflections.rb

Overview

ModelReflections will be the interface between the form object and form builders like simple_form.

This module is meant to collect all dependencies simple_form needs in addition to the ActiveModel ones. Goal is to collect all methods and define a reflection API so simple_form works with all ORMs and Reform doesn’t have to “guess” what simple_form and other form helpers need.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
# File 'lib/reform/form/model_reflections.rb', line 7

def self.included(base)
  base.register_feature self # makes it work in nested forms.
end

Instance Method Details

#column_for_attribute(name) ⇒ Object

Delegate column for attribute to the model to support simple_form’s attribute type interrogation.



13
14
15
# File 'lib/reform/form/model_reflections.rb', line 13

def column_for_attribute(name)
  model_for_property(name).column_for_attribute(name)
end