# File lib/dm-core/resource.rb, line 248
    def attributes(key_on = :name)
      attributes = {}
      properties.each do |property|
        if model.public_method_defined?(name = property.name)
          key = case key_on
            when :name  then name
            when :field then property.field
            else             property
          end

          attributes[key] = send(name)
        end
      end
      attributes
    end