Sha256: 08afe19aa0ff244877cd38ffe63655e781ac3e305c1c60e523b8ac23c0e3d451

Contents?: true

Size: 573 Bytes

Versions: 3

Compression:

Stored size: 573 Bytes

Contents

module StrongForm
  module Tag
    extend ActiveSupport::Concern
    included do
      alias_method :render_orig, :render

      def render
        if object.respond_to?(:permitted_attributes) && !object.permitted_attributes.nil?
          (@html_options || @options)[:disabled] ||=
            object.permitted_attributes != true &&
            (
              !object.permitted_attributes.include?(@method_name.to_sym) &&
              !object.permitted_attributes.include?("#{@method_name}": [])
            )
        end
        render_orig
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
strong_form-0.0.9 lib/strong_form/tag.rb
strong_form-0.0.8 lib/strong_form/tag.rb
strong_form-0.0.6 lib/strong_form/tag.rb