categoryz3 0.9.1 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/categoryz3/child_item.rb +1 -1
- data/app/models/categoryz3/item.rb +3 -3
- data/lib/categoryz3/categorizable.rb +3 -3
- data/lib/categoryz3/version.rb +1 -1
- metadata +34 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b94652a0dcea5f7906652800b346bd440b53cb64
|
4
|
+
data.tar.gz: 6276a1ca9929917c6347962888d8038066218ca9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afef625dd4a314c67073bb4eb3e3d5c0f64962e803ceab94fb49388bd634096a9d3b880b46c5c3ee93a15b159ef0d1b1e9b11421c8beec5ebbcf18f4f08a7940
|
7
|
+
data.tar.gz: 25abd103c35e37071bd35349cd01b5fd5cc9fb44ced8d38118d122983643dd9a1cd83ba47504185e14ab421eb47a0e85ed30bf563ab36a72a7e971db42d1eb0f
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Categoryz3
|
2
2
|
class ChildItem < ActiveRecord::Base
|
3
|
-
belongs_to :category, inverse_of: :child_items, counter_cache:
|
3
|
+
belongs_to :category, inverse_of: :child_items, counter_cache: :child_items_count
|
4
4
|
belongs_to :master_item, class_name: 'Categoryz3::Item', inverse_of: :child_items
|
5
5
|
belongs_to :categorizable, polymorphic: true, inverse_of: :child_category_items
|
6
6
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Categoryz3
|
2
2
|
class Item < ActiveRecord::Base
|
3
|
-
belongs_to :category, inverse_of: :direct_items, counter_cache:
|
3
|
+
belongs_to :category, inverse_of: :direct_items, counter_cache: :items_count
|
4
4
|
belongs_to :categorizable, polymorphic: true, inverse_of: :direct_category_items
|
5
|
-
has_many :child_items, foreign_key:
|
5
|
+
has_many :child_items, foreign_key: :master_item_id, inverse_of: :master_item, dependent: :destroy
|
6
6
|
|
7
7
|
validates :category, :categorizable, presence: true
|
8
8
|
validates :category_id, uniqueness: { scope: [:categorizable_type, :categorizable_id] }
|
@@ -12,7 +12,7 @@ module Categoryz3
|
|
12
12
|
# Public: Destroy the child items and recreate them
|
13
13
|
#
|
14
14
|
def reprocess_child_items!
|
15
|
-
self.child_items.
|
15
|
+
self.child_items.delete_all
|
16
16
|
create_child_items
|
17
17
|
end
|
18
18
|
|
@@ -26,18 +26,18 @@ module Categoryz3
|
|
26
26
|
|
27
27
|
has_many :categories,
|
28
28
|
through: :direct_category_items,
|
29
|
-
source:
|
29
|
+
source: :category,
|
30
30
|
class_name: 'Categoryz3::Category'
|
31
31
|
|
32
32
|
has_many :all_categories,
|
33
33
|
through: :child_category_items,
|
34
|
-
source:
|
34
|
+
source: :category,
|
35
35
|
class_name: 'Categoryz3::Category'
|
36
36
|
|
37
37
|
has_many :root_categories,
|
38
38
|
-> { where(parent_id: nil) },
|
39
39
|
through: :child_category_items,
|
40
|
-
source:
|
40
|
+
source: :category,
|
41
41
|
class_name: 'Categoryz3::Category'
|
42
42
|
|
43
43
|
scope :inside_category ,
|
data/lib/categoryz3/version.rb
CHANGED
metadata
CHANGED
@@ -1,83 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: categoryz3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Scolari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 4.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 4.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec-rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: database_cleaner
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: factory_girl_rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: ffaker
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
83
97
|
description: Works like a simple tagging system, but instead of tags it has categories,
|
@@ -88,6 +102,9 @@ executables: []
|
|
88
102
|
extensions: []
|
89
103
|
extra_rdoc_files: []
|
90
104
|
files:
|
105
|
+
- MIT-LICENSE
|
106
|
+
- README.rdoc
|
107
|
+
- Rakefile
|
91
108
|
- app/models/categoryz3/category.rb
|
92
109
|
- app/models/categoryz3/child_item.rb
|
93
110
|
- app/models/categoryz3/item.rb
|
@@ -95,18 +112,15 @@ files:
|
|
95
112
|
- db/migrate/20121003060539_create_categoryz3_categories.rb
|
96
113
|
- db/migrate/20121003060933_create_categoryz3_items.rb
|
97
114
|
- db/migrate/20121003061056_create_categoryz3_child_items.rb
|
115
|
+
- lib/categoryz3.rb
|
98
116
|
- lib/categoryz3/categorizable.rb
|
99
117
|
- lib/categoryz3/engine.rb
|
100
118
|
- lib/categoryz3/validators/child_item_category_validator.rb
|
101
119
|
- lib/categoryz3/validators/parent_category_validator.rb
|
102
120
|
- lib/categoryz3/version.rb
|
103
|
-
- lib/categoryz3.rb
|
104
|
-
- lib/generators/categoryz3/migrations/migrations_generator.rb
|
105
121
|
- lib/generators/categoryz3/migrations/USAGE
|
122
|
+
- lib/generators/categoryz3/migrations/migrations_generator.rb
|
106
123
|
- lib/tasks/categoryz3_tasks.rake
|
107
|
-
- MIT-LICENSE
|
108
|
-
- Rakefile
|
109
|
-
- README.rdoc
|
110
124
|
homepage: https://github.com/tscolari/categoryz3
|
111
125
|
licenses: []
|
112
126
|
metadata: {}
|
@@ -116,17 +130,17 @@ require_paths:
|
|
116
130
|
- lib
|
117
131
|
required_ruby_version: !ruby/object:Gem::Requirement
|
118
132
|
requirements:
|
119
|
-
- -
|
133
|
+
- - ">="
|
120
134
|
- !ruby/object:Gem::Version
|
121
135
|
version: '0'
|
122
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
137
|
requirements:
|
124
|
-
- -
|
138
|
+
- - ">="
|
125
139
|
- !ruby/object:Gem::Version
|
126
140
|
version: '0'
|
127
141
|
requirements: []
|
128
142
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.
|
143
|
+
rubygems_version: 2.2.1
|
130
144
|
signing_key:
|
131
145
|
specification_version: 4
|
132
146
|
summary: Simple categorization to ActiveRecord models.
|