public
Rubygem
Description: DataMapper - Core
Homepage: http://datamapper.org
Clone URL: git://github.com/sam/dm-core.git
Model#inherited copies @validations if the model responds to validators. 
Resolved #327.
Tue Jul 22 15:26:07 -0700 2008
commit  da8cd46364d10fb679beb660b604eecddf298f29
tree    1bab77564d7e721ed77b8ba46f1b83812d175a47
parent  450fee38931c30181198e7bac3d04ef5c876bd9f
...
39
40
41
 
42
43
44
...
39
40
41
42
43
44
45
0
@@ -39,6 +39,7 @@ module DataMapper
0
       target.instance_variable_set(:@properties, Hash.new { |h,k| h[k] = k == Repository.default_name ? PropertySet.new : h[Repository.default_name].dup })
0
       target.instance_variable_set(:@base_model, self.base_model)
0
       target.instance_variable_set(:@paranoid_properties, @paranoid_properties)
0
+ target.instance_variable_set(:@validations, @validations) if self.respond_to?(:validators)
0
 
0
       @properties.each do |repository_name,properties|
0
         repository(repository_name) do

Comments

  • dkubb Tue Jul 22 19:19:36 -0700 2008

    I’m not sure dm-core should know anything about dm-validations’ internals. It should be possible to make dm-validates modify Model’s inherited method so this happens. In general its ok for plugins to know enough about Model to override/replace the behaviour with their own, but I don’t think the reverse should be true.

  • carllerche Tue Jul 22 19:23:49 -0700 2008

    I would probably try using Hooks instead of overriding.