constant_table_saver 5.2.0 → 5.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/constant_table_saver.gemspec +3 -4
- data/lib/constant_table_saver.rb +1 -1
- data/lib/constant_table_saver/version.rb +1 -1
- data/test/constant_table_saver_test.rb +9 -0
- data/test_all.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c134fa69e000c07e356e932c19eb25e6ffee51cccc52918f7002111420ae0308
|
4
|
+
data.tar.gz: 7a0ad173328737c1e7389b1344ec7ba34078ff65d670c0f4916a3f349d46b8a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e53bac0b461c1903b0094cde22bb114d9bc1d13027f932b709cbffdcfa43fac4f9d6fc1804c6a1b8d94928916ef932d03a6ef2c489ed3ebcfc823412e4c2146e
|
7
|
+
data.tar.gz: 2977ad0e79639917206c41c8553ce5aae826ef803c23d4ad17e9628dd1d6bbbd44e1c0fd23e7682dbdd171c231fa19b192b5493a4d71e73e34070a9849c833f5
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ named after the name field you specify.
|
|
11
11
|
Compatibility
|
12
12
|
=============
|
13
13
|
|
14
|
-
Currently tested against Rails 5.2 (5.2.
|
14
|
+
Currently tested against Rails 5.2 (up to 5.2.1 and 5.2.2rc1), 5.1 (up to 5.1.6), 5.0 (up to 5.0.6), and 4.2 (up to 4.2.10).
|
15
15
|
|
16
16
|
For earlier versions of Rails, use an older version of the gem.
|
17
17
|
|
@@ -16,11 +16,10 @@ named after the name field you specify.
|
|
16
16
|
Compatibility
|
17
17
|
=============
|
18
18
|
|
19
|
-
Currently tested against Rails 5.2 (5.2.
|
19
|
+
Currently tested against Rails 5.2 (up to 5.2.1), 5.1 (up to 5.1.6) and 5.0 (up to 5.0.6) and 4.2 (up to 4.2.10).
|
20
20
|
|
21
21
|
For earlier versions of Rails, use an older version of the gem.
|
22
22
|
EOF
|
23
|
-
gem.has_rdoc = false
|
24
23
|
gem.author = "Will Bryant"
|
25
24
|
gem.email = "will.bryant@gmail.com"
|
26
25
|
gem.homepage = "http://github.com/willbryant/constant_table_saver"
|
@@ -33,8 +32,8 @@ EOF
|
|
33
32
|
|
34
33
|
gem.add_dependency "activerecord"
|
35
34
|
gem.add_development_dependency "rake"
|
36
|
-
gem.add_development_dependency "mysql2"
|
37
|
-
gem.add_development_dependency "pg"
|
35
|
+
gem.add_development_dependency "mysql2" # you probably want 0.4.10 if testing with old versions of rails, but this gem doesn't care
|
36
|
+
gem.add_development_dependency "pg" # you probably want 0.21.0 if testing with old versions of rails, but this gem doesn't care
|
38
37
|
gem.add_development_dependency "sqlite3"
|
39
38
|
gem.add_development_dependency "byebug"
|
40
39
|
end
|
data/lib/constant_table_saver.rb
CHANGED
@@ -71,7 +71,7 @@ module ConstantTableSaver
|
|
71
71
|
|
72
72
|
module ActiveRecord52ClassMethods
|
73
73
|
def find_by_sql(sql, binds = [], preparable: nil, &block)
|
74
|
-
@cached_records ||= super(relation.to_sql).each(&:freeze).freeze
|
74
|
+
@cached_records ||= super(relation.to_sql, &nil).each(&:freeze).freeze
|
75
75
|
|
76
76
|
@cached_results ||= @cached_records.each_with_object({
|
77
77
|
# matches .all queries:
|
@@ -8,6 +8,8 @@ end
|
|
8
8
|
class ConstantPie < ActiveRecord::Base
|
9
9
|
set_table_name "pies"
|
10
10
|
constant_table
|
11
|
+
|
12
|
+
has_one :ingredient, class_name: "IngredientForConstantPie", foreign_key: 'pie_id'
|
11
13
|
|
12
14
|
scope :filled_with_unicorn, -> { where(:filling => 'unicorn') }
|
13
15
|
|
@@ -234,4 +236,11 @@ class ConstantTableSaverTest < ActiveSupport::TestCase
|
|
234
236
|
ConstantPie.find([max_id, max_id + 1])
|
235
237
|
end
|
236
238
|
end
|
239
|
+
|
240
|
+
test "it correctly loads when includes are used" do
|
241
|
+
IngredientForConstantPie.includes(:pie).find_by(:id => 3)
|
242
|
+
assert_queries(2) do
|
243
|
+
IngredientForConstantPie.includes(:pie).find_by(:id => 3)
|
244
|
+
end
|
245
|
+
end
|
237
246
|
end
|
data/test_all.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'yaml'
|
4
4
|
|
5
|
-
rails_versions = ["5.2.0", "5.1.1".."5.1.6", "5.0.2".."5.0.6", "4.2.10"].flat_map {|spec| Array(spec).collect {|v| v.gsub /.0(\d)/, '.\\1'}}
|
5
|
+
rails_versions = ["5.2.2rc1", "5.2.0".."5.2.1", "5.1.1".."5.1.6", "5.0.2".."5.0.6", "4.2.10"].flat_map {|spec| Array(spec).collect {|v| v.gsub /.0(\d)/, '.\\1'}}
|
6
6
|
rails_envs = YAML.load(File.read("test/database.yml")).keys
|
7
7
|
|
8
8
|
rails_versions.each do |version|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: constant_table_saver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.2.
|
4
|
+
version: 5.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Will Bryant
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -105,7 +105,7 @@ description: |
|
|
105
105
|
Compatibility
|
106
106
|
=============
|
107
107
|
|
108
|
-
Currently tested against Rails 5.2 (5.2.
|
108
|
+
Currently tested against Rails 5.2 (up to 5.2.1), 5.1 (up to 5.1.6) and 5.0 (up to 5.0.6) and 4.2 (up to 4.2.10).
|
109
109
|
|
110
110
|
For earlier versions of Rails, use an older version of the gem.
|
111
111
|
email: will.bryant@gmail.com
|