rooble 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/lib/rooble/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e683f6845e705f291401d02c4fd35f75a2d95e6ec16136d08da48f2139df5e80
|
4
|
+
data.tar.gz: e5062b8a337dda95aea3b3e83e3505170af431eadf792aeda70625ae32245679
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8bebea75a21a281536f243755a37e62573b23c318ae53ffb52a80f336cc5cffbf2fd6baf916a28bd45aa6934745f9b5709fd6e5a8394bae553e10cd70252432
|
7
|
+
data.tar.gz: ec614c44c7d1f0e0afc14527400b2e57d84a7fd76b498f0c401b27cce5745421e1fbad8377a430c28ab88c11d66421b85d4af25d176f9a866ca8ef3ae14dc7d6
|
data/README.md
CHANGED
@@ -61,13 +61,14 @@ We can override the `max_records_per_page` as well on the first argument which i
|
|
61
61
|
```
|
62
62
|
|
63
63
|
``` ruby
|
64
|
-
Model.paginate(page=1, max_records_per_page=nil)
|
64
|
+
Model.paginate(page=1, max_records_per_page=nil, order_by: {id: :asc})
|
65
65
|
```
|
66
66
|
|
67
67
|
**Arguments:**
|
68
68
|
|
69
69
|
- `page` the page to pull records from
|
70
70
|
- `max_records_per_page` how many records to generate per page, this overrides the initializer option
|
71
|
+
- `order_by` how records will be ordered, defaults to the ID in Ascending order
|
71
72
|
|
72
73
|
`Model.paginate` will pull records for the first page. The first argument is the page number and you can also override the `max_records_per_page` config option on the second argument so that you paginate a specific page with a different amount of max records, for instance:
|
73
74
|
|
@@ -93,13 +94,14 @@ Note that in the 3rd example we override the `max_records_per_page` so we will g
|
|
93
94
|
The search method will lookup for keyword matches within columns or records that match a given id, this means that you can essentially use it only to search in text fields or in the primary key. So for instance if you try to search against numeric columns it won't work but for that type of specific search you are better off using ActiveRecord directly. The rational behind this is that most application _open_ searches will lookup for id's, names or codes, rarely against numeric values.
|
94
95
|
|
95
96
|
``` ruby
|
96
|
-
Model.search(fields, search_term, options={})
|
97
|
+
Model.search(fields, search_term, options={}, order_by: {id: :asc})
|
97
98
|
```
|
98
99
|
|
99
100
|
**Arguments:**
|
100
101
|
|
101
102
|
- `fields` a string with a field name or string/symbol array with field names to make the query against
|
102
103
|
- `search_term` string with the term to search
|
104
|
+
- `order_by` how records will be ordered, defaults to the ID in Ascending order
|
103
105
|
- `options` a hash with a set of options. Please se below for more info.
|
104
106
|
|
105
107
|
`Model.search("name", "John")` will look for records which have **John** within the `name` attribute.
|
data/lib/rooble/version.rb
CHANGED