Comments (5)
Does the Object type not work for you?
from dm-types.
Hmm, well, my use case is to ensure that the data is JSON-encoded for portability (other systems in other languages want to read the data). Too specific of a use case for dm-types? That and I have an aversion to storing marshaled data and would rather deal with explicitly versioning it (as a general statement about Object-based properties).
So, all I really want is a Json field that ensures a Hash and exposes the property as a Mash.
from dm-types.
@solnic what do you think? too specific for dm-types? I'm leaning that way but I wanted to get your input first.
from dm-types.
@nevir actually I think a better idea would be to extend existing Json property rather than adding a new one.
from dm-types.
The more I work with the Json property type, the more I think it's a real mistake that it doesn't use a Mash/HashWithIndifferentAccess.
Simply: the property allows you to set keys of symbol (or string) type. Until the property is persisted, you'll even be able to interact with the symbol keys. The moment you persist/reload, that behavior changes. This really doesn't seem to follow the "it behaves how I'd expect" principle, given what it's supposed to represent, nor the "it behaves consistently" principle.
Seems like "it should work" would be a far more common case than "it shouldn't work/I'd want it to error out". And, FWIW, preventing symbol keys from being used in the first place would feel pedantically heavy-handed on the positive side, outright retarded on the negative.
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.