columns_on_demand 5.2.0 → 6.0.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: c35479e9e268cbc8b33a8b981e28728a76745894e3dd91ca4fcbc92903fcd1b4
4
- data.tar.gz: cc6bc4f1ed2476f225d40fd3aa74f47ab1ef8041661efda8e4ba4a2cb41d4fef
3
+ metadata.gz: 1883a4021dfc69d3c3ce1b12c02f14cfb8d5ad40b7dcf0e382c638ebe20528f1
4
+ data.tar.gz: b9da84f7409d34203123dc0c9a2c9ed59ed65004cfb08994ad4f13be1e1bad83
5
5
  SHA512:
6
- metadata.gz: 0f48f8af4a0cdfcaac66e0169467125513fc54d9995dc8e798d06ed9b30901196ad2a14959622afec8579ba4306545d766d4f48a197b888360feb951c2f4f314
7
- data.tar.gz: 48643342903f8b5d04d69d27f3a5573a78d776f72f6fbdfdcb3f3287e60c016c08b1223cce6c7d0ccd70383ed1a5dad116979e48def4ee340435f3595a02330e
6
+ metadata.gz: 25931accb7f33e305383400d6d780d119508298a3ae4baa66fdc374daaf459f47cee7fd7390de790af785075ef7a62b53bd6d79716269487e989952d6979a4c2
7
+ data.tar.gz: 5477645b767cbc9bf7f9acff349b6fd7c515980905921137f49f8e335c4ed937b89b2cd689f802fd5b296b5129ae1e73899303dd438265af22ca06e36335a3c7
@@ -0,0 +1,14 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ dist: bionic
6
+ rvm:
7
+ - 2.6
8
+ services:
9
+ - postgresql
10
+ - mysql
11
+ before_script:
12
+ - createdb -U postgres columns_on_demand_test
13
+ - mysqladmin -u root create columns_on_demand_test
14
+ script: ./test_all.sh
data/Gemfile CHANGED
@@ -11,3 +11,4 @@ gemspec
11
11
  # your gem to rubygems.org.
12
12
 
13
13
  gem 'rails', ENV['RAILS_VERSION']
14
+ gem 'sqlite3', ENV['SQLITE3_VERSION']
data/README.md CHANGED
@@ -21,9 +21,7 @@ Compatibility
21
21
 
22
22
  Supports mysql, mysql2, postgresql, and sqlite3.
23
23
 
24
- Currently tested against Rails 5.2 (up to 5.2.0.beta2), 5.1 (up to 5.1.4), 5.0 (up to 5.0.6), and 4.2 (up to 4.2.10), on Ruby 2.3.6, 2.4.3, and 2.5.0.
25
-
26
- For earlier versions of Rails, use an older version of the gem.
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.
27
25
 
28
26
 
29
27
  Example
@@ -53,5 +51,6 @@ Thanks
53
51
  * Tim Connor (@tlconnor)
54
52
  * Tobias Matthies (@tobmatth)
55
53
  * Phil Ross (@philr)
54
+ * Jens Schmidt (@w3dot0)
56
55
 
57
- Copyright (c) 2008-2018 Will Bryant, Sekuda Ltd, released under the MIT license
56
+ Copyright (c) 2008-2020 Will Bryant, Sekuda Ltd, released under the MIT license
@@ -19,16 +19,7 @@ pages since they are not stored wholly in the record's page itself.
19
19
 
20
20
  Although this plugin is mainly used for BLOB and TEXT columns, it will actually
21
21
  work on all types - and is just as useful for large string fields etc.
22
-
23
-
24
- Compatibility
25
- =============
26
-
27
- Supports mysql, mysql2, postgresql, and sqlite3.
28
-
29
- Currently tested against Rails 3.2.18, 4.0.8, and 4.1.4, on Ruby 2.0.0.
30
22
  EOF
31
- gem.has_rdoc = false
32
23
  gem.author = "Will Bryant"
33
24
  gem.email = "will.bryant@gmail.com"
34
25
  gem.homepage = "http://github.com/willbryant/columns_on_demand"
@@ -107,6 +107,16 @@ module ColumnsOnDemand
107
107
  super(attr_name, &block)
108
108
  end
109
109
 
110
+ def write_attribute(attr_name, value)
111
+ ensure_loaded(attr_name)
112
+ super(attr_name, value)
113
+ end
114
+
115
+ def _write_attribute(attr_name, value)
116
+ ensure_loaded(attr_name)
117
+ super(attr_name, value)
118
+ end
119
+
110
120
  def missing_attribute(attr_name, *args)
111
121
  if columns_to_load_on_demand.include?(attr_name)
112
122
  load_attributes(attr_name)
@@ -1,3 +1,3 @@
1
1
  module ColumnsOnDemand
2
- VERSION = '5.2.0'
2
+ VERSION = '6.0.0'
3
3
  end
@@ -148,6 +148,13 @@ class ColumnsOnDemandTest < ActiveSupport::TestCase
148
148
  assert_equal "somefile.txt", attributes["original_filename"]
149
149
  assert_equal "This is the file data!", attributes["file_data"]
150
150
  end
151
+
152
+ test "it loads the column when changing its value" do
153
+ record = Implicit.first
154
+ record.file_data = 'This is the new file data!'
155
+ assert_equal "This is the file data!", record.file_data_was
156
+ assert_equal ["This is the file data!", "This is the new file data!"], record.changes[:file_data]
157
+ end
151
158
 
152
159
  test "it loads the column when generating #to_json" do
153
160
  ActiveRecord::Base.include_root_in_json = true
@@ -177,7 +184,8 @@ class ColumnsOnDemandTest < ActiveSupport::TestCase
177
184
 
178
185
  test "it does not think the column has been loaded if a reloaded instance that has not loaded the attribute is saved" do
179
186
  record = Implicit.first
180
- record.update_attributes!(:file_data => "New file data")
187
+ record.file_data = "New file data"
188
+ record.save!
181
189
 
182
190
  record.reload
183
191
  record.save!
@@ -187,7 +195,8 @@ class ColumnsOnDemandTest < ActiveSupport::TestCase
187
195
 
188
196
  test "it does not think the column has been loaded if a fresh instance that has not loaded the attribute is saved" do
189
197
  record = Implicit.first
190
- record.update_attributes!(:file_data => "New file data")
198
+ record.file_data = "New file data"
199
+ record.save!
191
200
 
192
201
  record = Implicit.find(record.id)
193
202
  record.save!
@@ -281,9 +290,9 @@ class ColumnsOnDemandTest < ActiveSupport::TestCase
281
290
 
282
291
  assert !ValidatedImplicit.new(:original_filename => "test.txt").valid?
283
292
  instance = ValidatedImplicit.create!(:original_filename => "test.txt", :file_data => "test file data", :results => "test results")
284
- instance.update_attributes!({}) # file_data and results are already loaded
293
+ assert instance.valid? # file_data and results are already loaded
285
294
  new_instance = ValidatedImplicit.find(instance.id)
286
- new_instance.update_attributes!({}) # file_data and results aren't loaded yet, but will be loaded to validate
295
+ assert new_instance.valid? # file_data and results aren't loaded yet, but will be loaded to validate
287
296
  end
288
297
 
289
298
  test "it works with serialized columns" do
@@ -2,10 +2,18 @@
2
2
 
3
3
  set -e
4
4
 
5
- for version in 4.2.10 5.0.6 5.1.4 5.2.0.beta2
5
+ for version in 5.0.7.2 5.1.7 5.2.4.4
6
6
  do
7
- RAILS_VERSION=$version bundle update rails
7
+ RAILS_VERSION=$version SQLITE3_VERSION=1.3.9 bundle update rails sqlite3
8
8
  RAILS_ENV=sqlite3 bundle exec rake
9
9
  RAILS_ENV=postgresql bundle exec rake
10
10
  RAILS_ENV=mysql2 bundle exec rake
11
- done
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
16
+ RAILS_ENV=sqlite3 bundle exec rake
17
+ RAILS_ENV=postgresql bundle exec rake
18
+ RAILS_ENV=mysql2 bundle exec rake
19
+ done
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: 5.2.0
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Bryant
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-02 00:00:00.000000000 Z
11
+ date: 2020-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -108,20 +108,13 @@ description: |
108
108
 
109
109
  Although this plugin is mainly used for BLOB and TEXT columns, it will actually
110
110
  work on all types - and is just as useful for large string fields etc.
111
-
112
-
113
- Compatibility
114
- =============
115
-
116
- Supports mysql, mysql2, postgresql, and sqlite3.
117
-
118
- Currently tested against Rails 3.2.18, 4.0.8, and 4.1.4, on Ruby 2.0.0.
119
111
  email: will.bryant@gmail.com
120
112
  executables: []
121
113
  extensions: []
122
114
  extra_rdoc_files: []
123
115
  files:
124
116
  - ".gitignore"
117
+ - ".travis.yml"
125
118
  - Gemfile
126
119
  - MIT-LICENSE
127
120
  - README.md
@@ -143,7 +136,7 @@ homepage: http://github.com/willbryant/columns_on_demand
143
136
  licenses:
144
137
  - MIT
145
138
  metadata: {}
146
- post_install_message:
139
+ post_install_message:
147
140
  rdoc_options: []
148
141
  require_paths:
149
142
  - lib
@@ -158,9 +151,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
151
  - !ruby/object:Gem::Version
159
152
  version: '0'
160
153
  requirements: []
161
- rubyforge_project:
162
- rubygems_version: 2.7.3
163
- signing_key:
154
+ rubygems_version: 3.0.3
155
+ signing_key:
164
156
  specification_version: 4
165
157
  summary: Lazily loads large columns on demand.
166
158
  test_files: