Sha256: b5649177aa9e5287fabf8a9b0bfba8ed516ee1999e92baac2cc26c722de56051

Contents?: true

Size: 512 Bytes

Versions: 7

Compression:

Stored size: 512 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

7 entries across 7 versions & 1 rubygems

Version Path
strong_form-0.0.8 lib/strong_form/record.rb
strong_form-0.0.6 lib/strong_form/record.rb
strong_form-0.0.5 lib/strong_form/record.rb
strong_form-0.0.4 lib/strong_form/record.rb
strong_form-0.0.3 lib/strong_form/record.rb
strong_form-0.0.2 lib/strong_form/record.rb
strong_form-0.0.1 lib/strong_form/record.rb