-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plans for dirty tracking? #42
Comments
What would be the use case for non-persistent objects? In a non-persistent environment, would some kind of observer system where you could register code for handling on-change events give you the ability to do the same thing? If you had some way to observe events, then tracking them in a UnitOfWork would be relatively simple. One other thing I would like to add, is that if we were going to add observers or dirty tracking I would much rather see it being handled outside of the virtus gem. I think virtus almost does as much as it needs to, and I would even propose that the heavy lifting in the coercions system should be extracted. Virtus, like DataMapper and ActiveRecord/ActiveModel give people this really convenient place to hang extra behaviour from. It's all-too-easy to keep adding more and more behaviour into Virtus. I think everything we do should be considered if it would be possible to add to regular Ruby objects, and if it can, then it should be done first.. then if we need any glue code to make it work with Virtus we can add that second. |
You mean like https://github.com/solnic/virtus-dirty_tracking ? |
@emmanuel As @namelessjon points out I already wrote a plugin for DT although it was just a quick code spike to test a different approach than what we have in dm-core/dm-types at the moment. I'm still not sure if DT should be a part of virtus or a virtus plugin. As @dkubb writes we're dealing with a non-persistent environment so it's hard to justify why you would need dirty tracking. We briefly talked about it with @dkubb and kind of agreed that DT should be a part of UoW/Session which will not be coupled with Virtus (if I remember correctly). |
@namelessjson — Thanks for the pointer! Between Also, I agree that dirty-tracking on non-persistent objects is probably not a widespread use-case, and probably shouldn't be in |
Are there any plans to implement dirty tracking support in Virtus? I can do what I want without it, but it would be handy in some circumstances.
I believe the plan with DM2 is to manage dirty tracking in a
UnitOfWork
/Session
object, but I'd like it for non-persistent objects.The text was updated successfully, but these errors were encountered: