Sha256: 4005bb845c33638a77956b7d074f9c57d6b43f89607d6f2d0e2b728405089b70

Contents?: true

Size: 874 Bytes

Versions: 3

Compression:

Stored size: 874 Bytes

Contents

# Patch connections between DataMapper and Rails 2.3.5
module DataMapper
  module Resource
    alias :attributes_orig= :attributes=
    # avoid object references in URLs
    def to_param; id.to_s; end
    # silence deprecation warnings
    def new_record?; new?; end
    # avoid NoMethodError
    def update_attributes(*args); update(*args); end

    # make sure that all properties of the model that have to do with
    # date or time are converted run through the fix_date converter
    def attributes=(attributes)
      return if attributes.nil?
      self.class.properties.each do |t|
        if !(t.name.to_s =~ /.*_at/) && (t.type.to_s =~ /Date|Time/ ) &&
            attributes.include?("#{t.name.to_s}(1i)")
          MultiparameterAssignments.fix_date(attributes, t.name.to_s, t.type)
        end
      end
      self.attributes_orig=(attributes)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_dm_datastore-0.2.11.pre lib/rails_dm_datastore/data_mapper.rb
rails_dm_datastore-0.2.10 lib/rails_dm_datastore/data_mapper.rb
rails_dm_datastore-0.2.9 lib/rails_dm_datastore/data_mapper.rb