occams-record 0.13.1 → 0.14.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 +2 -1
- data/lib/occams-record/results.rb +1 -1
- data/lib/occams-record/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: c38ef4286e850f0409ef60595a18e28dfce74f9b43b60fa776d782f899e800c9
|
4
|
+
data.tar.gz: 4960fa6e619bbc4e20dbaf94fb5d557ddd5f8ed50443b4ad5f5716fb4da1a383
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7f32e7259a88470318e0aac8e89d62c993d443c4ff379392cc7eb731f7649c5cb958994e25be2f23386e0ee0b73d05fc07998a71be6faf7f224c3231560010f
|
7
|
+
data.tar.gz: 9ced85fba2d01430725e33d97984775b7a2a59f14a0fa11b03965302a528cd99a138fa913e4d0ec2b58f7fd9356bfffe79359b3a2ed3a25fa9a99bcff040ee7c
|
data/README.md
CHANGED
@@ -159,12 +159,13 @@ widgets = OccamsRecord.
|
|
159
159
|
|
160
160
|
**Using find_each/find_in_batches with raw SQL**
|
161
161
|
|
162
|
-
To use `find_each` or `find_in_batches` with raw SQL you must provide the `LIMIT` and `OFFSET`
|
162
|
+
To use `find_each` or `find_in_batches` with raw SQL you must provide the `LIMIT` and `OFFSET` clauses yourself. The bind values for these will be filled in by OccamsRecord. Remember to always specific a consitent `ORDER BY` clause.
|
163
163
|
|
164
164
|
```ruby
|
165
165
|
widgets = OccamsRecord.sql(%(
|
166
166
|
SELECT * FROM widgets
|
167
167
|
WHERE category_id = %{cat_id}
|
168
|
+
ORDER BY name, id
|
168
169
|
LIMIT %{batch_limit}
|
169
170
|
OFFSET %{batch_offset}
|
170
171
|
), {
|
@@ -20,7 +20,7 @@ module OccamsRecord
|
|
20
20
|
#
|
21
21
|
def self.klass(column_names, column_types, association_names = [], model: nil, modules: nil)
|
22
22
|
Class.new(Results::Row) do
|
23
|
-
Array(modules).each { |mod|
|
23
|
+
Array(modules).each { |mod| prepend mod } if modules
|
24
24
|
|
25
25
|
self.columns = column_names.map(&:to_s)
|
26
26
|
self.associations = association_names.map(&:to_s)
|