
Resource#save fails for resources with non-serial keys that have defaults
Reported by Lincoln Ritter | August 21st, 2008 @ 04:38 PM
Saving a new resource with a non-serial, key property that has a default value fails and the resource does not get created. It seems that the resource isn't saved since it is not marked dirty and does not have any serial keys even though the value will be set via the default once it is accessed. For example
class Ticket
include DataMapper::Resource
property :id, String, :key => true, :default => lambda {|r,p| UUID.new}
end
Ticket.new.save # fails!
This ticket includes a patch that includes a spec demonstrating the problem and code that solves this problem.
Comments and changes to this ticket
-
Lincoln Ritter August 21st, 2008 @ 04:41 PM
- no changes were found...
-
Dan Kubb (dkubb) December 5th, 2008 @ 04:21 AM
- State changed from new to resolved
- Assigned user cleared.
I can confirm that this is no longer an issue with dkubb/dm-core
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.