gleborator 0.1.1.11 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -9
- data/lib/gleborator/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdc1ef979bbd95e9651ceab840c341b143e4d130
|
4
|
+
data.tar.gz: 3f2291dddb4f6de4f1bdcbd4eea05d3197444d01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fdc8eabe778740a2c740043ec23f68d0835cbcf6b6b8fc56c2caba06ec1b4f3c0d437c9fb98aa055ab4e018141b11cad164d2d4851b9cd3ef3d91af5a08ccbb
|
7
|
+
data.tar.gz: d2fa971dcd83fcfbe68956269600e66be0c72fe53bdcdc45863264b65a785388458e186a4784c7093c977d42f9d27105279a4036939b6c4f60556284d0bbd70e
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Gleborator
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
It is velosiped of draper gem created by Gleb Vishnevsky.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,17 +20,31 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
You have to call decorate method on what you want to decorate
|
24
|
+
```ruby
|
25
|
+
# app/controllers/posts_controller.rb
|
26
|
+
def show
|
27
|
+
@post = Post.find(params[:id]).decorate
|
28
|
+
end
|
29
|
+
```
|
28
30
|
|
29
|
-
|
31
|
+
It will search for PostDecorator and create instance of it. There you can create your own methods to keep your views cleaner.
|
30
32
|
|
31
|
-
|
33
|
+
```ruby
|
34
|
+
# app/decorators/post_decorator.rb
|
35
|
+
class PostDecorator < ApplicationDecorator
|
36
|
+
delegate :id, :title, :body
|
37
|
+
delegate :name, to: :author, prefix: true
|
38
|
+
|
39
|
+
def title_with_author_name
|
40
|
+
"#{object.title} (#{object.author_name)})"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
```
|
32
44
|
|
33
45
|
## Contributing
|
34
46
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
47
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kaikash/gleborator.
|
36
48
|
|
37
49
|
|
38
50
|
## License
|
data/lib/gleborator/version.rb
CHANGED