Sha256: 01df045b8f9d08affb210581cb7fec91a6e7865afcfb1e067806c37df92779c8

Contents?: true

Size: 801 Bytes

Versions: 1

Compression:

Stored size: 801 Bytes

Contents

module StrongForm
  class Railtie < Rails::Railtie
    initializer 'strong_form.injects' do
      ActiveSupport.on_load(:active_record) do
        ActiveRecord::Base.include StrongForm::Record
      end

      ActiveSupport.on_load(:action_view) do
        %w(
          CheckBox
          CollectionSelect
          DateSelect
          RadioButton
          Select
          TextArea
          TextField
          TimeZoneSelect
        ).each do |klass|
          "ActionView::Helpers::Tags::#{klass}"
            .constantize.include StrongForm::Tag
        end

        if defined?(::NestedForm)
          require('strong_form/nested_form')
          require('nested_form/builder_mixin')
          ::NestedForm::BuilderMixin.include StrongForm::NestedForm
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
strong_form-0.0.9 lib/strong_form/railtie.rb