Sha256: 5efb90d5f3da601e376f6396320ac313037deeba8fa99c620c73fff7e0251932

Contents?: true

Size: 580 Bytes

Versions: 7

Compression:

Stored size: 580 Bytes

Contents

module Reform
  class Form
    # TODO: this should be in Representer namespace.
    module EmptyAttributesOptions
      def options
        empty_fields = representable_attrs.
          find_all { |d| d.options[:empty] }.
          collect  { |d| d.name.to_sym }

        super.exclude!(empty_fields)
      end
    end

    module ReadonlyAttributesOptions
      def options
        readonly_fields = representable_attrs.
          find_all { |d| d.options[:virtual] }.
          collect  { |d| d.name.to_sym }

        super.exclude!(readonly_fields)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
reform-0.2.7 lib/reform/form/virtual_attributes.rb
reform-0.2.6 lib/reform/form/virtual_attributes.rb
reform-0.2.5 lib/reform/form/virtual_attributes.rb
reform-0.2.4 lib/reform/form/virtual_attributes.rb
reform-0.2.3 lib/reform/form/virtual_attributes.rb
reform-0.2.2 lib/reform/form/virtual_attributes.rb
reform-0.2.1 lib/reform/form/virtual_attributes.rb