Comments (5)
Currently DataMapper only tracks changes caused by calling the mutator methods, not changes using the reference to the value internally.
So for example, if you have a String, and you set the user.name using user.name = "gondar", and then later you use user.name << "other" to append to the String, DataMapper isn’t going to notice the change since you modified the value that it has a reference to.
DataMapper used to track this sort of change, but it incurred a large overhead and was needlessly complex. I removed it until we could figure out a better approach.
I suppose it may be possible if we take a snapshot of the object attributes’ Object#hash values when it is loaded, and then compare those when it comes time to save the object. I’m not yet sure what sort of overhead this will have, but it may be worth looking into later.
For now I am going to mark this as a "suggestion" and we will revisit it prior to 1.0
by Dan Kubb (dkubb)
from dm-types.
I wish this ticket were higher on google, but here’s a workaround for anyone else who, like me, finds this type not very useful without this feature. Unfortunately, it will always save the YAML property if it has been loaded at all.
before :save, :dump_yaml
def dump_yaml
self.yaml_prop = YAML.dump(self.yaml_prop) if attribute_loaded? :yaml_prop
end
by blavender (at gmail)
from dm-types.
I added a pending spec for this and sent a pull request, see http://github.com/bhuga/dm-more/commit/e09a0579290a7036ee19f4d9f8c173ebad2a9654
by blavender (at gmail)
from dm-types.
Note that pull request 33 (#33) would fix this use case.
from dm-types.
@jpr5's pull request was merged which solves this problem. Closing this ticket.
If the problem still persists please add a comment to this ticket, otherwise enjoy!
from dm-types.
Related Issues (20)
- DataMapper Incomatibilities with rails 3.1 HOT 1
- bcrypt-ruby update HOT 4
- IPAddress Property does not typecast Resolv::IPv4 / Resolv::IPv6 objects HOT 3
- Please update JSON dependency to 1.6.x HOT 7
- dm-types redefines the global CSV constant on Ruby 1.8 HOT 3
- ParanoidBoolean causes issues with belongs_to Relationships HOT 1
- DataMapper::Property::IPAddress attempts to typecase LIKE-queries HOT 5
- UUID: got error on jruby HOT 2
- uninitialized constant ClassName::Enum HOT 3
- Enums are nil when an already created object is fetched HOT 6
- multi-json dependency HOT 1
- Bump stringex dependency to ~>2.0.2 HOT 5
- [release 1.2] rspec failing HOT 1
- Upgrade to safe_yaml
- Exception when assigning an arbitrary string to a Json field
- brcypt-ruby name change HOT 6
- can't modify frozen NilClass HOT 12
- Missing code in release v1.2.2 HOT 3
- UUID missing from migration type map HOT 1
- Update json dependency HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dm-types.