occams-record 1.1.6 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 466aabbac2317ba6b65e5d02c4f244f317640bbbea08a2949c4b4ebe59be5bfb
4
- data.tar.gz: cd50c8465764d9f811acccd1d833357ced98e2ba5812e3c5d12a3f2534495fb1
3
+ metadata.gz: f20725f84205589f6d7f9f11b54870e7cdc4697020863133e8669f80ef9c601d
4
+ data.tar.gz: 3abfc4b311d439d866ff40c512f8a7ce478c0f938483fb6805dad1a1ac4c1ebc
5
5
  SHA512:
6
- metadata.gz: d5935484d5a729eb82fa12eb6402b48d7a54f54d9d8fe2986694eada3af26296c88536c78bbf2a05239483d66deb2c0a7bd6f70097b51547d95d5ded77bbec11
7
- data.tar.gz: b0162c9054e18a8c1c265de9e47b5cd2bb00dcc53bd7406a166d67b3c4a390389a0e06f80e345fff8ed89fc2b7edb2b87a9e30a4fc165c6a4f9be2541bbebd71
6
+ metadata.gz: 03272f59314447452b174e24c0e8b334fbd9ce0a03ef29b54d353710b29f08b679a8d3b8e5e6108593a10019a84a7069519810e37c7598e79d3002f7314f7ede
7
+ data.tar.gz: e9b99f0ef4e60c0ac1e70d431dc40ac9e2f0d265e4687eba9dbf8163ce89894baca4b50c2e34b3e8cecbc99727800039b404eedb0e156a2b887b5e9736d20780
data/README.md CHANGED
@@ -12,14 +12,14 @@ OccamsRecord is a high-efficiency, advanced query library for use alongside Acti
12
12
 
13
13
  ### 2) Supercharged querying & eager loading
14
14
 
15
- Continue using ActiveRecord's query builder, but let Occams take over eager loading and raw SQL calls. None of the examples below are possible with ActiveRecord, but OccamsRecord won't limit you. (More complete examples are shown later, but these should whet your appetite.)
15
+ Continue using ActiveRecord's query builder, but let Occams take over running them, eager loading, and raw SQL calls. None of the examples below are possible with ActiveRecord, but OccamsRecord makes them trivial. (More complete examples are shown later, but these should whet your appetite.)
16
16
 
17
17
  **Customize the SQL used to eager load associations**
18
18
 
19
19
  ```ruby
20
20
  OccamsRecord.
21
21
  query(User.active).
22
- eager_load(:orders, ->(q) { q.where("created_at >= ?", date })
22
+ eager_load(:orders, ->(q) { q.where("created_at >= ?", date).order("created_at DESC") })
23
23
  ```
24
24
 
25
25
  **Use `ORDER BY` with `find_each`/`find_in_batches`**
@@ -34,7 +34,7 @@ module OccamsRecord
34
34
  #
35
35
  def merge!(assoc_rows, rows)
36
36
  Merge.new(rows, name).
37
- single!(assoc_rows, {@ref.foreign_key.to_s => @ref.active_record_primary_key.to_s})
37
+ single!(assoc_rows, {@ref.foreign_key.to_s => @ref.association_primary_key.to_s})
38
38
  end
39
39
  end
40
40
  end
@@ -152,7 +152,7 @@ module OccamsRecord
152
152
  def define_ids_reader!(assoc)
153
153
  model = self.class._model
154
154
  ref = model.reflections[assoc]
155
- pkey = ref.association_primary_key.to_sym
155
+ pkey = ref.klass.primary_key.to_sym
156
156
 
157
157
  self.class.class_eval do
158
158
  define_method "#{assoc.singularize}_ids" do
@@ -3,5 +3,5 @@
3
3
  #
4
4
  module OccamsRecord
5
5
  # Library version
6
- VERSION = "1.1.6".freeze
6
+ VERSION = "1.1.7".freeze
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: occams-record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Hollinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-14 00:00:00.000000000 Z
11
+ date: 2020-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord