Sha256: cfcd94590c270d09b677e2694c51d1d1e35d677d5ea905b7d7353b3400ef9bbf

Contents?: true

Size: 869 Bytes

Versions: 1

Compression:

Stored size: 869 Bytes

Contents

module HungryForm
  module Rails
    class Railtie < ::Rails::Railtie

      module Configuration
        attr_accessor :rails

        def self.extended(base)
          base.rails = ActiveSupport::OrderedOptions.new

          base.rails.elements_templates = 'hungryform'
          base.rails.error_class = 'invalid'

          [:next_button_class, :prev_button_class, :submit_button_class].each do |button|
            base.rails.send(button, '')
          end
        end
      end

      initializer 'hungryform', before: :load_config_initializers do
        HungryForm::Elements::Base::Element.send :include, Renderable
        HungryForm.configuration.extend Configuration
      end

      initializer 'active_support' do
        ActiveSupport.on_load(:action_view) do
          ::ActionView::Base.send :include, ActionView
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hungryform-rails-0.0.5 lib/hungryform/rails/railtie.rb