Sha256: 134365f32e4654e9e4f6fe09272190e7ea31c1fc0bb7eac856511163ecce3efa

Contents?: true

Size: 816 Bytes

Versions: 4

Compression:

Stored size: 816 Bytes

Contents

# 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.
module Reform::Form::ModelReflections
  def self.included(base)
    base.register_feature self # makes it work in nested forms.
  end

  # Delegate column for attribute to the model to support simple_form's
  # attribute type interrogation.
  def column_for_attribute(name)
    model_for_property(name).column_for_attribute(name)
  end

  # this should also contain to_param and friends as this is used by the form helpers.
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
reform-1.2.2 lib/reform/form/model_reflections.rb
reform-1.2.1 lib/reform/form/model_reflections.rb
reform-1.2.0.beta2 lib/reform/form/model_reflections.rb
reform-1.2.0.beta1 lib/reform/form/model_reflections.rb