columns_on_demand 6.0.0 → 6.1.0

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: 1883a4021dfc69d3c3ce1b12c02f14cfb8d5ad40b7dcf0e382c638ebe20528f1
4
- data.tar.gz: b9da84f7409d34203123dc0c9a2c9ed59ed65004cfb08994ad4f13be1e1bad83
3
+ metadata.gz: d1e6e04d64f6f526080014087994ae0a6ec5b0561fcf02b25cedbf425ca78b77
4
+ data.tar.gz: 25cc43696bb8a5e93650bf95e02143e4071006566e59bdb690c1a1d870b69994
5
5
  SHA512:
6
- metadata.gz: 25931accb7f33e305383400d6d780d119508298a3ae4baa66fdc374daaf459f47cee7fd7390de790af785075ef7a62b53bd6d79716269487e989952d6979a4c2
7
- data.tar.gz: 5477645b767cbc9bf7f9acff349b6fd7c515980905921137f49f8e335c4ed937b89b2cd689f802fd5b296b5129ae1e73899303dd438265af22ca06e36335a3c7
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 6.1.0.rc1, 6.0.3.4, 5.2.4.4, 5.1.7, and 5.0.7.2, with older gem versions compatible with earlier Rails versions.
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-2020 Will Bryant, Sekuda Ltd, released under the MIT license
56
+ Copyright (c) 2008-2024 Will Bryant, Sekuda Ltd, released under the MIT license
@@ -1,3 +1,3 @@
1
1
  module ColumnsOnDemand
2
- VERSION = '6.0.0'
2
+ VERSION = '6.1.0'
3
3
  end
@@ -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
@@ -1,11 +1,9 @@
1
1
  mysql:
2
2
  adapter: mysql
3
3
  database: columns_on_demand_test
4
- username: root
5
4
  mysql2:
6
5
  adapter: mysql2
7
6
  database: columns_on_demand_test
8
- username: root
9
7
  postgresql:
10
8
  adapter: postgresql
11
9
  database: columns_on_demand_test
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[ENV['RAILS_ENV']]
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
- ActiveSupport::TestCase.fixture_path = File.join(File.dirname(__FILE__), "fixtures")
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.0.7.2 5.1.7 5.2.4.4
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.3.9 bundle update rails sqlite3
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.0.0
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: 2020-11-12 00:00:00.000000000 Z
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.0.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.