Sha256: e20e691b7bcfc437675aa469631141c311a457afc5a91eda52c4560c23274a21

Contents?: true

Size: 609 Bytes

Versions: 4

Compression:

Stored size: 609 Bytes

Contents

module BootstrapForm
  module Helpers
    module Field
      def required_field_options(options, method)
        required = required_field?(options, method)
        {}.tap do |option|
          option[:required] = true if required
        end
      end

      private

      def required_field?(options, method)
        if options[:skip_required]
          warn "`:skip_required` is deprecated, use `:required: false` instead"
          false
        elsif options.key?(:required)
          options[:required]
        else
          required_attribute?(object, method)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bootstrap_form-5.4.0 lib/bootstrap_form/helpers/field.rb
bootstrap_form-5.3.2 lib/bootstrap_form/helpers/field.rb
bootstrap_form-5.3.1 lib/bootstrap_form/helpers/field.rb
bootstrap_form-5.3.0 lib/bootstrap_form/helpers/field.rb