activerecord-records_on_load 0.1.3 → 0.1.4

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
  SHA1:
3
- metadata.gz: 76db2c9b83e8f15c27e1fe7a3f7f386d445f4432
4
- data.tar.gz: df14f2482bdbe0472c08341ba1afa4e06a73a04a
3
+ metadata.gz: 7e6595644a9ff567d8112ea141c9c38bdc63ab15
4
+ data.tar.gz: faf2f163b4307c8225910d17b2fae79d68f94c8c
5
5
  SHA512:
6
- metadata.gz: f1dd9773ca2612a9caf58c0493d152b676afc19e27ac2c5e3ceea1692f8e6ce456a4f6a98f345256820f771b6ce381825ba6d4c9a20a02e322debba0b8093894
7
- data.tar.gz: 738a1417875417787c164006dc032c860ad181de40f967325e45ec245768e36a71ec575cd0e2a72bcdc043154727ffa2c42ae8127e358b1d82516685e5e25b18
6
+ metadata.gz: ea5daf395ee4155841cfabd96a666737e9cc79563e2098d434d9606d04fae73c3b7a883cd85bd35c0bac0f9f4f655f901504f32b436cd0971fd99ca78198c0c7
7
+ data.tar.gz: ad27de72d8a94388f205a50d5b6b680bfa4007ac76f5acc4b5260a7023916e007d4055fa24c9e84c0c0ae7a5aadec8cc8adf65c84b692e1e3e427f048ae5f0a0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activerecord-records_on_load (0.1.2)
4
+ activerecord-records_on_load (0.1.4)
5
5
  activerecord
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,9 +1,5 @@
1
1
  # Activerecord::RecordsOnLoad
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/activerecord/records_on_load`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
3
  ## Installation
8
4
 
9
5
  Add this line to your application's Gemfile:
@@ -28,7 +24,10 @@ User.all.on_load do |records|
28
24
  end
29
25
 
30
26
  User.all.on_load do |records|
31
- ActiveRecord::Associations::Preloader.new.preload(records.select(&:admin?), :role)
27
+ ActiveRecord::Associations::Preloader.new.preload(
28
+ records.select(&:admin?),
29
+ :role
30
+ )
32
31
  end
33
32
  ```
34
33
 
@@ -4,7 +4,9 @@ module ActiveRecord
4
4
  super(&block)
5
5
 
6
6
  if @_on_load_blocks.present?
7
- @_on_load_blocks.each { |b| b.call(@records) }
7
+ @_on_load_blocks.each do |b|
8
+ b.call(@records)
9
+ end
8
10
  end
9
11
 
10
12
  self
@@ -13,7 +15,7 @@ module ActiveRecord
13
15
  def on_load(&block)
14
16
  @_on_load_blocks ||= []
15
17
  @_on_load_blocks << block
16
- self
18
+ clone
17
19
  end
18
20
  end
19
21
  end
@@ -1,5 +1,5 @@
1
1
  module Activerecord
2
2
  module RecordsOnLoad
3
- VERSION = '0.1.3'
3
+ VERSION = '0.1.4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-records_on_load
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jun0kada
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-01 00:00:00.000000000 Z
11
+ date: 2019-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord