deckorator 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/lib/deckorator/delegator.rb +5 -0
- data/lib/deckorator/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3078b1fb68ab78418fe9f6b9c28f577a8a1c556
|
4
|
+
data.tar.gz: d77f82ad5c2f69af043b55b8defdd6bc9dfaa1f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 201b1aa1230f26921d2c3e250b6c234efea407af0ebe3cf8de6b688b31ae08e52a5b3de2f0ff6d4af930ce3b4308476063c89ccf0d3ec66241476b1dcc1614bb
|
7
|
+
data.tar.gz: 092da84521948181ef688df8c6d05b7c84911cc066bc9311218240ca252b537bd0d041843f1de58131534053c0a1d3274a203b95c60d7d08a6e3db44f282c53e
|
data/README.md
CHANGED
@@ -82,6 +82,16 @@ $ rails g deckorator:decorator user
|
|
82
82
|
|
83
83
|
This will create a `UserDecorator` in the `app/decorators` directory while also generating a stubbed test.
|
84
84
|
|
85
|
+
#### Also using Pundit?
|
86
|
+
|
87
|
+
You might want to add this to your **app/decorators/ApplicationDecorator**:
|
88
|
+
|
89
|
+
```rb
|
90
|
+
def self.policy_class
|
91
|
+
"#{decorated_object_class}Policy"
|
92
|
+
end
|
93
|
+
```
|
94
|
+
|
85
95
|
## Related
|
86
96
|
|
87
97
|
* <https://github.com/drapergem/draper>
|
data/lib/deckorator/delegator.rb
CHANGED
@@ -10,6 +10,11 @@ module Deckorator
|
|
10
10
|
super
|
11
11
|
end
|
12
12
|
|
13
|
+
def to_param
|
14
|
+
decorated_object.respond_to?(:to_param) ?
|
15
|
+
decorated_object.to_param : super
|
16
|
+
end
|
17
|
+
|
13
18
|
module ClassMethods
|
14
19
|
def method_missing(method, *args, &block)
|
15
20
|
decorated_object_class.respond_to?(method) ?
|
data/lib/deckorator/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deckorator
|
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
|
- John Otander
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-02-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -131,9 +131,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
version: '0'
|
132
132
|
requirements: []
|
133
133
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.4.
|
134
|
+
rubygems_version: 2.4.5.1
|
135
135
|
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: Lightweight decorators using plain old Ruby objects.
|
138
138
|
test_files: []
|
139
|
-
has_rdoc:
|