chanko 2.0.7 → 2.0.8
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/.travis.yml +1 -0
- data/CHANGELOG.md +3 -0
- data/README.md +7 -1
- data/lib/chanko/version.rb +1 -1
- data/lib/generators/chanko/unit/templates/unit.rb.erb +7 -1
- data/spec/chanko/exception_handler_spec.rb +3 -3
- data/spec/dummy/app/units/entry_deletion/entry_deletion.rb +6 -0
- data/spec/dummy/config/environments/production.rb +1 -1
- data/spec/dummy/config/environments/test.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 68c4176b063d78567c7cb08d88d0868e6f0cb892
|
|
4
|
+
data.tar.gz: 78ec98e8831cb4fd913e55a399538a4cc1ae7084
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 48b0858c605f85a665a1d614831d9fa3f60b5bac1fb74099065edcf061c61c2ab08b0faad3a833d8445941299a3869501a02f7c8f0b445473485f6abe817ca8f
|
|
7
|
+
data.tar.gz: b7139c166079d65b2bf88acaebced6170a32ebc77e303c9da082160bfb75c948a10865a0284ede9d1585cae947cd45955d69531033ea3afe7a238bfb08745698
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -134,7 +134,7 @@ end
|
|
|
134
134
|
### models
|
|
135
135
|
In models block, you can expand model features by `expand` method.
|
|
136
136
|
The expanded methods are available via unit proxy like `User.unit.active`,
|
|
137
|
-
|
|
137
|
+
`User.find(params[:id]).unit.active?` or `User.unit.gc_all_soft_deleted_users`.
|
|
138
138
|
|
|
139
139
|
```ruby
|
|
140
140
|
models do
|
|
@@ -144,6 +144,12 @@ models do
|
|
|
144
144
|
def active?
|
|
145
145
|
deleted_at.nil?
|
|
146
146
|
end
|
|
147
|
+
|
|
148
|
+
class_methods do
|
|
149
|
+
def gc_all_soft_deleted_users
|
|
150
|
+
where.not(deleted_at: nil).delete_all
|
|
151
|
+
end
|
|
152
|
+
end
|
|
147
153
|
end
|
|
148
154
|
end
|
|
149
155
|
```
|
data/lib/chanko/version.rb
CHANGED
|
@@ -48,7 +48,7 @@ module <%= class_name %>
|
|
|
48
48
|
# ## models
|
|
49
49
|
# In models block, you can expand model features by `expand` method.
|
|
50
50
|
# The expanded methods are available via unit proxy like `User.unit.active`,
|
|
51
|
-
#
|
|
51
|
+
# `User.find(params[:id]).unit.active?` or `User.unit.gc_all_soft_deleted_users`.
|
|
52
52
|
#
|
|
53
53
|
# ```
|
|
54
54
|
# models do
|
|
@@ -58,6 +58,12 @@ module <%= class_name %>
|
|
|
58
58
|
# def active?
|
|
59
59
|
# deleted_at.nil?
|
|
60
60
|
# end
|
|
61
|
+
#
|
|
62
|
+
# class_methods do
|
|
63
|
+
# def gc_all_soft_deleted_users
|
|
64
|
+
# where.not(deleted_at: nil).delete_all
|
|
65
|
+
# end
|
|
66
|
+
# end
|
|
61
67
|
# end
|
|
62
68
|
# end
|
|
63
69
|
# ```
|
|
@@ -21,7 +21,7 @@ module Chanko
|
|
|
21
21
|
|
|
22
22
|
it "raises up error without any logging" do
|
|
23
23
|
expect(Logger).not_to receive(:debug)
|
|
24
|
-
expect { described_class.handle(error, insensitive_unit) }.to raise_error
|
|
24
|
+
expect { described_class.handle(error, insensitive_unit) }.to raise_error(error)
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -47,13 +47,13 @@ module Chanko
|
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
it "raises up error" do
|
|
50
|
-
expect { described_class.handle(error, insensitive_unit) }.to raise_error
|
|
50
|
+
expect { described_class.handle(error, insensitive_unit) }.to raise_error(error)
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
context "when unit.raise_error is configured" do
|
|
55
55
|
it "raises up error" do
|
|
56
|
-
expect { described_class.handle(error, sensitive_unit) }.to raise_error
|
|
56
|
+
expect { described_class.handle(error, sensitive_unit) }.to raise_error(error)
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
end
|
|
@@ -9,7 +9,7 @@ Dummy::Application.configure do
|
|
|
9
9
|
config.action_controller.perform_caching = true
|
|
10
10
|
|
|
11
11
|
# Disable Rails's static asset server (Apache or nginx will already do this)
|
|
12
|
-
config.
|
|
12
|
+
config.serve_static_files = false
|
|
13
13
|
|
|
14
14
|
# Compress JavaScripts and CSS
|
|
15
15
|
config.assets.compress = true
|
|
@@ -8,7 +8,7 @@ Dummy::Application.configure do
|
|
|
8
8
|
config.cache_classes = true
|
|
9
9
|
|
|
10
10
|
# Configure static asset server for tests with Cache-Control for performance
|
|
11
|
-
config.
|
|
11
|
+
config.serve_static_files = true
|
|
12
12
|
config.static_cache_control = "public, max-age=3600"
|
|
13
13
|
|
|
14
14
|
# Show full error reports and disable caching
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: chanko
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryo Nakamura
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-09-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -301,7 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
301
301
|
version: '0'
|
|
302
302
|
requirements: []
|
|
303
303
|
rubyforge_project:
|
|
304
|
-
rubygems_version: 2.
|
|
304
|
+
rubygems_version: 2.4.5.1
|
|
305
305
|
signing_key:
|
|
306
306
|
specification_version: 4
|
|
307
307
|
summary: Rails extension tool
|
|
@@ -371,3 +371,4 @@ test_files:
|
|
|
371
371
|
- spec/fixtures/units/sensitive_inactive_unit/sensitive_inactive_unit.rb
|
|
372
372
|
- spec/fixtures/units/sensitive_unit/sensitive_unit.rb
|
|
373
373
|
- spec/spec_helper.rb
|
|
374
|
+
has_rdoc:
|