columns_on_demand 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/columns_on_demand/version.rb +1 -1
- data/lib/columns_on_demand.rb +8 -0
- data/test/columns_on_demand_test.rb +12 -0
- data/test/database.yml +0 -2
- data/test/test_helper.rb +7 -2
- data/test_all.sh +2 -10
- 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: d1e6e04d64f6f526080014087994ae0a6ec5b0561fcf02b25cedbf425ca78b77
|
4
|
+
data.tar.gz: 25cc43696bb8a5e93650bf95e02143e4071006566e59bdb690c1a1d870b69994
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64411dd375053f0bdbbe6806faa08500c6d774b6093717504456192c4b9751a560a3f9ca63a15c772a6da86015fb31c6f9da1c69cf392ad736aabf0a5f1b56a6
|
7
|
+
data.tar.gz: 0d07cb102b4a5ac022bd8afa71cb6c1e3d261a23da004a668c23c208b67090fd064f843874099559f526582b40bd3edadf5cfc0e6323230d33c1cfe1d9854451
|
data/README.md
CHANGED
@@ -21,7 +21,7 @@ Compatibility
|
|
21
21
|
|
22
22
|
Supports mysql, mysql2, postgresql, and sqlite3.
|
23
23
|
|
24
|
-
Currently tested against Rails
|
24
|
+
Currently tested against Rails 7.2.0.beta2, 7.1.3.4, 7.0.8.4, and 6.1.7.8, with older gem versions compatible with earlier Rails versions.
|
25
25
|
|
26
26
|
|
27
27
|
Example
|
@@ -53,4 +53,4 @@ Thanks
|
|
53
53
|
* Phil Ross (@philr)
|
54
54
|
* Jens Schmidt (@w3dot0)
|
55
55
|
|
56
|
-
Copyright (c) 2008-
|
56
|
+
Copyright (c) 2008-2024 Will Bryant, Sekuda Ltd, released under the MIT license
|
data/lib/columns_on_demand.rb
CHANGED
@@ -63,6 +63,14 @@ module ColumnsOnDemand
|
|
63
63
|
def attribute_names
|
64
64
|
(super + columns_to_load_on_demand).uniq.sort
|
65
65
|
end
|
66
|
+
|
67
|
+
def attribute_method?(attr_name)
|
68
|
+
super || columns_to_load_on_demand.include?(attr_name)
|
69
|
+
end
|
70
|
+
|
71
|
+
def _has_attribute?(attr_name)
|
72
|
+
super || columns_to_load_on_demand.include?(attr_name)
|
73
|
+
end
|
66
74
|
|
67
75
|
def load_attributes(*attr_names)
|
68
76
|
return if attr_names.blank?
|
@@ -239,6 +239,18 @@ class ColumnsOnDemandTest < ActiveSupport::TestCase
|
|
239
239
|
|
240
240
|
assert_equal "This is the file data!", record.file_data # check it doesn't raise
|
241
241
|
end
|
242
|
+
|
243
|
+
test "it reports the columns in the class-level attribute_method?" do
|
244
|
+
assert(Implicit.attribute_method?("file_data"))
|
245
|
+
end
|
246
|
+
|
247
|
+
test "it reports the columns in the instance-level attribute_method?" do
|
248
|
+
assert(Implicit.first.send(:attribute_method?, "file_data"))
|
249
|
+
end
|
250
|
+
|
251
|
+
test "it makes the instance classes respond_to the attribute even if not loaded" do
|
252
|
+
assert(Implicit.first.respond_to?(:file_data))
|
253
|
+
end
|
242
254
|
|
243
255
|
test "it handles STI models" do
|
244
256
|
class Sti < ActiveRecord::Base
|
data/test/database.yml
CHANGED
data/test/test_helper.rb
CHANGED
@@ -23,11 +23,16 @@ rescue LoadError
|
|
23
23
|
end
|
24
24
|
|
25
25
|
ActiveRecord::Base.configurations = YAML::load(IO.read(File.join(File.dirname(__FILE__), "database.yml")))
|
26
|
-
configuration = ActiveRecord::Base.configurations
|
26
|
+
configuration = ActiveRecord::Base.configurations.find_db_config(ENV['RAILS_ENV'])
|
27
27
|
raise "use RAILS_ENV=#{ActiveRecord::Base.configurations.keys.sort.join '/'} to test this plugin" unless configuration
|
28
28
|
ActiveRecord::Base.establish_connection configuration
|
29
29
|
|
30
30
|
ActiveSupport::TestCase.send(:include, ActiveRecord::TestFixtures) if ActiveRecord.const_defined?('TestFixtures')
|
31
|
-
|
31
|
+
|
32
|
+
if ActiveSupport::TestCase.respond_to?(:fixture_paths)
|
33
|
+
ActiveSupport::TestCase.fixture_paths = [File.join(File.dirname(__FILE__), "fixtures")]
|
34
|
+
else
|
35
|
+
ActiveSupport::TestCase.fixture_path = File.join(File.dirname(__FILE__), "fixtures")
|
36
|
+
end
|
32
37
|
|
33
38
|
require File.expand_path(File.join(File.dirname(__FILE__), '../init')) # load columns_on_demand
|
data/test_all.sh
CHANGED
@@ -2,17 +2,9 @@
|
|
2
2
|
|
3
3
|
set -e
|
4
4
|
|
5
|
-
for version in
|
5
|
+
for version in 6.1.7.8 7.0.8.4 7.1.3.4 7.2.0.beta2
|
6
6
|
do
|
7
|
-
RAILS_VERSION=$version SQLITE3_VERSION=1.
|
8
|
-
RAILS_ENV=sqlite3 bundle exec rake
|
9
|
-
RAILS_ENV=postgresql bundle exec rake
|
10
|
-
RAILS_ENV=mysql2 bundle exec rake
|
11
|
-
done
|
12
|
-
|
13
|
-
for version in 6.0.3.4 6.1.0.rc1
|
14
|
-
do
|
15
|
-
RAILS_VERSION=$version SQLITE3_VERSION=1.4.1 bundle update rails sqlite3
|
7
|
+
RAILS_VERSION=$version SQLITE3_VERSION=1.5.0 bundle update rails sqlite3
|
16
8
|
RAILS_ENV=sqlite3 bundle exec rake
|
17
9
|
RAILS_ENV=postgresql bundle exec rake
|
18
10
|
RAILS_ENV=mysql2 bundle exec rake
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: columns_on_demand
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Will Bryant
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
requirements: []
|
154
|
-
rubygems_version: 3.
|
154
|
+
rubygems_version: 3.3.26
|
155
155
|
signing_key:
|
156
156
|
specification_version: 4
|
157
157
|
summary: Lazily loads large columns on demand.
|