jbuilder-jpartial 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/jbuilder/jpartial/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: b3b16018a2a317dd73d9b7c335f36bb5617b4a71
|
4
|
+
data.tar.gz: 32a5d28866d2253646d97d6b7c88c4e47352f9f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ae11bfc5c2936ab47a50b5875bcb8c481a75a582db3d0be1e300dd9586685688542910191ed0872db8654ed79aae45ffb1a970607ec65ef3e0b34e3df6bcd8c
|
7
|
+
data.tar.gz: 1642559e330f11d60c8dc6da29213e1642dc30e51fad449e75cc058da9b489b65f2fc7971419dc2e9bfec7115e5ff4e4adf06fb0e603ab6a03992f2293efde97
|
data/README.md
CHANGED
@@ -78,7 +78,7 @@ The result is faster rendering and lower memory usage, while still being able to
|
|
78
78
|
|
79
79
|
Alternatively you can define all partials in one initializer file and call them wherever you need them: from within other partial definitions or anywhere you use `Jbuilder` in your views. The advantage here is fewer files, all partials in one place, and since they're initialized at start up, you don't need to call any additional view templates to render the partials. Using the same example as above:
|
80
80
|
|
81
|
-
#### In `app/config/initializers/
|
81
|
+
#### In `app/config/initializers/jpartial.rb`
|
82
82
|
```ruby
|
83
83
|
Jbuilder::Jpartial.configure do |jpartial|
|
84
84
|
jpartial._post do |post|
|
@@ -106,7 +106,7 @@ end
|
|
106
106
|
|
107
107
|
Notice that when using this method, we don't make any calls like `json.partial! 'post'` at any point to define the partial before using it. All of the partials are already defined in the initializer file.
|
108
108
|
|
109
|
-
The advantage is
|
109
|
+
The advantage is even fewer renders and faster responses. The only real disadvantage is it bucks the regular Rails partial conventions. C'est la vie.
|
110
110
|
|
111
111
|
#### How?
|
112
112
|
Each method you call on `jpartial` defines a Jbuilder method of the same name. The objects you will pass to that method are yielded to the block. Inside the block you can use plain old Jbuilder syntax.
|