Module: Superform::Rails

Defined in:
lib/superform/rails.rb,
lib/superform/rails/form.rb,
lib/superform/rails/field.rb,
lib/superform/rails/option_mapper.rb,
lib/superform/rails/components/base.rb,
lib/superform/rails/components/field.rb,
lib/superform/rails/components/input.rb,
lib/superform/rails/components/label.rb,
lib/superform/rails/components/button.rb,
lib/superform/rails/components/select.rb,
lib/superform/rails/strong_parameters.rb,
lib/superform/rails/components/checkbox.rb,
lib/superform/rails/components/textarea.rb

Defined Under Namespace

Modules: Components, StrongParameters Classes: Field, Form, OptionMapper

Constant Summary collapse

SUPERCLASSES =

When this is included in a Rails app, check if ‘Components::Base` is defined and inherit from that so we get all the users stuff; otherwise inherit from Phlex::HTML, which means we won’t have all the users methods and overrides.

[
  "::Components::Base",       # Phlex 2.x base class in a Rails project
  "::ApplicationComponent",   # Phlex 1.x base class in a Rails project
  "::Phlex::HTML",            # Couldn't detect a base Phlex Rails class, so use Phlex::HTML
]
Component =

Set the base class for the rem

base_class

Class Method Summary collapse

Class Method Details

.base_classObject

Find the base class for the Rails app.



15
16
17
# File 'lib/superform/rails.rb', line 15

def self.base_class
  const_get SUPERCLASSES.find { |const| const_defined?(const) }
end