data-mapper-is-versioned creates its versioned model -- e.g.,
User::Versions for a User model -- like by calling...
model = self.const_set("Version",
DataMapper::Model.new(storage_name))
...and then copying over the properties with a properties.each
iteration.
This implementation breaks plug-ins who use instance variables in the
model.
For example, merb_dm_xss_terminate stores its configuration in a hash.
Because the actual model is never instantiated the versioned model
doesn't get the configuration and falls back to the defaults.
Would it possible to create the "inner model" by creating a new
instance of the class model (e.g., User), change it's name and then --
as before -- run that through the const_set and iterate through/set
the properties?
I've tried to implement this but my kung-fu isn't quite up to it.
FWIW, anyone who wants to use merb_dm_xss_terminate and dm-is-
versioned together will have this problem. I've been knocking down
other problems getting these two to work together. I've had one patch
accepted and another is confirmed but not in yet.
I've made it work by copying over instance variables like so...
[EMAIL PROTECTED] @validations
@storage_names @properties @relationships}
instance_variables.each do |ivar|
unless protected_ivars.include?(ivar)
model.instance_variable_set(ivar.to_sym,
self.instance_eval(ivar))
end
end
...but this is horrible because of the whole protected_ivars thing.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---