ork 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +16 -0
- data/lib/ork/model/class_methods.rb +9 -0
- data/lib/ork/model/document.rb +1 -1
- data/ork.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47e2643acef3adcb2aeac374845b5361247ba439
|
4
|
+
data.tar.gz: 28fe5d544ea0c7fbb31d8630429a207d73cae3be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f25201cb3a85190b9f9b1fdcb07ea09b0c7aec3c820304547b90c3e66129e2fa6c15900d531493f817ad53c2f28af4b06630c9cb91b9102ba53c61dc7ccb2a1c
|
7
|
+
data.tar.gz: 3beec74ee51de51612f07191eb1421dd5c558404048ad18e6d8e3d15a4560387efcc1dfc30f0bbd2240abcfa72d319a41a24c5d20f71060536af61ff0be2496d
|
data/README.md
CHANGED
@@ -171,3 +171,19 @@ Provides an accessor to the object that `embeds` the current model.
|
|
171
171
|
```ruby
|
172
172
|
embedded :post, :Post
|
173
173
|
```
|
174
|
+
|
175
|
+
## Validations
|
176
|
+
|
177
|
+
As you can see, there is no reference to validations in this document and I'm aware of that!
|
178
|
+
The validation logic for _nested embedded objects_ makes the code more complex than I want.
|
179
|
+
Given that I want to keep this gem as simple as I can, I decided to avoid _object validation_ logic here and promote the use of other gems.
|
180
|
+
|
181
|
+
There are good implementations for object validation like [hatch](https://github.com/tonchis/hatch) or [scrivener](https://github.com/soveran/scrivener) which they do a great job!
|
182
|
+
If you don't know them, you should take a look, but remember that you are free to use your prefered _gem_ or even your own method!
|
183
|
+
|
184
|
+
Just remember to check if an object is _valid_ __before__ you _save_ it.
|
185
|
+
|
186
|
+
|
187
|
+
# Tools
|
188
|
+
|
189
|
+
* `rekon` - A visual browser for **riak**, built as a [riak app](https://github.com/basho/rekon).
|
@@ -38,6 +38,15 @@ module Ork::Model
|
|
38
38
|
@defaults ||= {}
|
39
39
|
end
|
40
40
|
|
41
|
+
# When a value is given, sets the content_type of the object.
|
42
|
+
# When the parameter is nil, it will return the content_type.
|
43
|
+
# It also sets as default the standard content_type.
|
44
|
+
#
|
45
|
+
def content_type(type = nil)
|
46
|
+
@content_type = type unless type.nil?
|
47
|
+
@content_type ||= 'application/json'
|
48
|
+
end
|
49
|
+
|
41
50
|
protected
|
42
51
|
|
43
52
|
# Declares persisted attributes.
|
data/lib/ork/model/document.rb
CHANGED
data/ork.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emiliano Mancuso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: riak-client
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
97
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.
|
98
|
+
rubygems_version: 2.1.9
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: Ruby modeling layer for Riak.
|