mongoid-ancestry 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/mongoid-ancestry/class_methods.rb +3 -3
- data/lib/mongoid-ancestry/version.rb +1 -1
- data/spec/lib/ancestry_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 874d735ff7aad0729f7436b2a93e92b4f6b175ca
|
4
|
+
data.tar.gz: cc44d718b74d884a4d40db2e311bc108ed777288
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27cae01753bc6f639df487bd4b2b4341680d8a668108b3c00290e0e00324c894a4bfc7859cee5e6b773452ed74f80abacfe48e932d1e5283f86f80908f351b31
|
7
|
+
data.tar.gz: 87e5dd56e393895a3098bb4159786b83a238c764584e244e699e9ef67404cac81b5508ce5380ef90914ccca202435ce9876f7c03a0de564db4c6e4ded2b9b5d4
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Mongoid-ancestry
|
2
2
|
================
|
3
3
|
|
4
|
-
[![travis](https://secure.travis-ci.org/
|
4
|
+
[![travis](https://secure.travis-ci.org/skyeagle/mongoid-ancestry.png)](http://travis-ci.org/skyeagle/mongoid-ancestry)
|
5
5
|
|
6
6
|
Mongoid-ancestry is a gem/plugin that allows the records of a Ruby on Rails Mongoid model to be organised as a tree structure (or hierarchy). It uses a single, intuitively formatted database column, using a variation on the materialised path pattern. It exposes all the standard tree structure relations (ancestors, parent, root, children, siblings, descendants) and all of them can be fetched in a single query. Additional features are STI support, scopes, depth caching, depth constraints, easy migration from older plugins/gems, integrity checking, integrity restoration, arrangement of (sub)tree into hashes and different strategies for dealing with orphaned records.
|
7
7
|
|
@@ -34,8 +34,8 @@ module Mongoid
|
|
34
34
|
self.orphan_strategy = opts[:orphan_strategy]
|
35
35
|
|
36
36
|
# Create touch accessor and set to option or default
|
37
|
-
cattr_accessor :
|
38
|
-
self.
|
37
|
+
cattr_accessor :ancestry_touchable
|
38
|
+
self.ancestry_touchable = opts[:touchable]
|
39
39
|
|
40
40
|
# Validate format of ancestry column value
|
41
41
|
primary_key_format = opts[:primary_key_format] || /[a-z0-9]+/
|
@@ -78,7 +78,7 @@ module Mongoid
|
|
78
78
|
before_save :update_descendants_with_new_ancestry
|
79
79
|
|
80
80
|
before_save :touch_parent, if: ->(obj) {
|
81
|
-
obj.
|
81
|
+
obj.ancestry_touchable && obj.send(:"#{self.class.ancestry_field}_changed?")
|
82
82
|
}
|
83
83
|
|
84
84
|
# Apply orphan strategy before destroy
|
data/spec/lib/ancestry_spec.rb
CHANGED
@@ -36,13 +36,13 @@ describe MongoidAncestry do
|
|
36
36
|
|
37
37
|
it "should have default touchable value" do
|
38
38
|
subject.with_model do |model|
|
39
|
-
model.
|
39
|
+
model.ancestry_touchable.should be_false
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should set touchable value" do
|
44
44
|
subject.with_model touchable: true do |model|
|
45
|
-
model.
|
45
|
+
model.ancestry_touchable.should be_true
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-ancestry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Kroes
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|