
Model does not save when changed Yaml-property
Reported by Sindre Aarsaether | November 9th, 2009 @ 09:12 AM
Simple showcase:
# encoding: utf-8
require 'rubygems'
require 'dm-core'
require 'dm-types'
DataMapper::setup(:default, "mysql://root@localhost/dm_core_test")
DataObjects::Mysql.logger = DataObjects::Logger.new(STDOUT, :debug)
class Person
include DataMapper::Resource
property :id, Serial
property :name, String # Can be string?
property :params, Yaml
end
DataMapper.auto_migrate!
p = Person.create :name => "Sindre"
p.params = {'test' => 1}
puts p.save # => false
puts p.save! # => false
Started happening sometime in the last few weeks.
Comments and changes to this ticket
-
Dan Kubb (dkubb) November 10th, 2009 @ 01:13 AM
- State changed from unconfirmed to resolved
(from [e66c1bd0c98bff8b5fd383438369555b32835b1e]) Fixed problem with Resource#save failing with custom properties
- Resource#save now tests the loaded value rather than the dumped value for validity.
- Updated variable names to differentiate between a loaded value and a dumped value. A loaded value is what is set within the Resource after retrieving/loading/typecasting it. A dumped value is what is stored in the datastore.
- Fixed Object type so if loaded value is nil, it will just store nil rather than sending an encoded String to the datastore
- Fixed Property#primitive? so that properties with a Text primitive can be tested for validity.
- Added specs for Object type
[#1118 state:resolved] http://github.com/datamapper/dm-core/commit/e66c1bd0c98bff8b5fd3834...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
People watching this ticket
Tags
Referenced by
-
1118 Model does not save when changed Yaml-property [#1118 state:resolved] http://github.com/datamapper/dm-c...