cast_about_for 0.1.1 → 0.1.2
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/README.md +6 -3
- data/lib/cast_about_for/search.rb +1 -1
- data/lib/cast_about_for/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: f89b80544593269d2556df48a28845c7b9afb875
|
4
|
+
data.tar.gz: f32a8afe8c775646c101a17976ff144d43d43076
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1ee3ad830d4fa24b31b4f45c000561120c72059b0945741909aa3e980ae952005f593eadea3ee95d2ce734387d88e63e8b6fff9b5cb9811302b10d6e84d3441
|
7
|
+
data.tar.gz: 071d92105a788ec87ba1a930dd42c88962637a2feea7ad956e2b018ac02569288687d94abb2b4e9236519da367ab877d756c87fdfa5782ae35a7059c29f652f9
|
data/README.md
CHANGED
@@ -242,11 +242,14 @@ If you are using `JSON API`, you can set in the `#cast_about_for`:
|
|
242
242
|
```
|
243
243
|
|
244
244
|
### Custom Query by Block
|
245
|
+
If want to find products where belong to some people, you can do it like:
|
245
246
|
|
246
247
|
```ruby
|
247
|
-
|
248
|
-
|
249
|
-
|
248
|
+
params = { user_name: 'hello', age: 20 }
|
249
|
+
|
250
|
+
Product.cast_about_for(params, jsonapi: true) do |products, cast_params|
|
251
|
+
products = products.joins(:user).where("users.name Like ?", "%#{cast_params[:user_name]}%") if cast_params[:user_name].present?
|
252
|
+
products = products.joins(:user).where("users.age = ?", cast_params[:age]) if cast_params[:age].present?
|
250
253
|
end
|
251
254
|
```
|
252
255
|
|