Module: DataMapper::Resource

Defined in:
lib/rails_dm_datastore/data_mapper.rb

Instance Method Summary collapse

Instance Method Details

#attributes=(attributes) ⇒ Object

make sure that all properties of the model that have to do with date or time are converted run through the fix_date converter



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rails_dm_datastore/data_mapper.rb', line 17

def attributes=(attributes)
  return if attributes.nil?
  self.class.properties.each do |t|
    if !(t.name.to_s =~ /.*_at/) && (t.primitive.to_s =~ /Date|Time/ ) &&
        attributes.include?("#{t.name.to_s}(1i)")
      puts 'here fixing attribute'
      MultiparameterAssignments.fix_date(attributes, t.name.to_s, t.primitive)
    end
  end
  self.attributes_orig=(attributes)
end

#attributes_orig=Object



5
# File 'lib/rails_dm_datastore/data_mapper.rb', line 5

alias :attributes_orig= :attributes=

#new_record?Boolean

silence deprecation warnings

Returns:

  • (Boolean)


11
# File 'lib/rails_dm_datastore/data_mapper.rb', line 11

def new_record?; new?; end

#to_paramObject

avoid object references in URLs



8
# File 'lib/rails_dm_datastore/data_mapper.rb', line 8

def to_param; id.to_s; end

#update_attributes(*args) ⇒ Object

avoid NoMethodError



13
# File 'lib/rails_dm_datastore/data_mapper.rb', line 13

def update_attributes(*args); update(*args); end