Sha256: 08d71b82e6141c143ed1807e6845e3d1860e6953d4a7a23586049e37c0dd6878

Contents?: true

Size: 566 Bytes

Versions: 4

Compression:

Stored size: 566 Bytes

Contents

require 'bootstrap_form'

module BootstrapValidatorRails
  class FormBuilder < BootstrapForm::FormBuilder
    def initialize(object_name, object, template, options)
      @attributes = BootstrapValidatorRails::Validators::Attributes.new(object)
      super
    end

    FIELD_HELPERS.each do |method_name|
      define_method(method_name) do |method, options = {}|
        attribute = @attributes.validator_data(method)
        options[:data] ||= {}
        options[:data] = options[:data].merge(attribute)
        super(method, options)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bootstrap_validator_rails-0.4.2 lib/bootstrap_validator_rails/form_builder.rb
bootstrap_validator_rails-0.4.1 lib/bootstrap_validator_rails/form_builder.rb
bootstrap_validator_rails-0.4.0 lib/bootstrap_validator_rails/form_builder.rb
bootstrap_validator_rails-0.3.0 lib/bootstrap_validator_rails/form_builder.rb