Sha256: a7e9047b2444c4d3defd9a51ddca5684ca4d97ee1cac2ab4cd961b553636236f

Contents?: true

Size: 691 Bytes

Versions: 3

Compression:

Stored size: 691 Bytes

Contents

module StrongForm
  def self.inject
    ActiveRecord::Base.include StrongForm::Record

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

    defined?(NestedForm) && require('strong_form/nested_form')
  end

  class Railtie < Rails::Railtie
    initializer 'strong_form.injects' do
      if !Rails.env.test? && Rails.configuration.cache_classes
        StrongForm.inject
      else
        ActionDispatch::Reloader.to_prepare { StrongForm.inject }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
strong_form-0.0.3 lib/strong_form/railtie.rb
strong_form-0.0.2 lib/strong_form/railtie.rb
strong_form-0.0.1 lib/strong_form/railtie.rb