Sha256: 09862b942a9a5a29f2ec3696b5b4fe1f21208f2b3cae16ab964b0e9572c96386

Contents?: true

Size: 516 Bytes

Versions: 1

Compression:

Stored size: 516 Bytes

Contents

module StrongForm
  module Record
    attr_accessor :permitted_attributes

    # allows to check if nested attributes are allowed
    #
    # permitted_nested_attributes?(:addresses) is true if
    # :addresses_attributes are permitted or everything is permitted
    def permitted_nested_attributes?(attr)
      permitted_attributes.nil? || permitted_attributes == true ||
        permitted_attributes.any? do |o|
          o.is_a?(Hash) && o.keys.include?("#{attr}_attributes".to_sym)
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
strong_form-0.0.9 lib/strong_form/record.rb