columns_on_demand 4.2.1.1 → 4.2.2

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: 8a8010a746904aba625f76e9cc94aea832a4d1ce
4
- data.tar.gz: e56464f8d159f2432c01b2abc857223a8e4958c8
3
+ metadata.gz: 638b2974e1909f9b850d1e28e99ef45a309933a9
4
+ data.tar.gz: 5f7121e622e2bfe7bd2e3d3aecfae2653da6f6ad
5
5
  SHA512:
6
- metadata.gz: 09348f00918c3892e2360a910bf43e7c73b1a46c713d2769e36164f2087ecf38ecd801605ad97f7c3524c61bf73aefa7892d22a52e83b786f9ebc9a587ef528f
7
- data.tar.gz: 2c575715505105f36f57d2d315b2b991a572bf4d7866de1bd9a9fe410ef8f438ccda2ed25ff57cfc209739e8548a11e4a44f93593da1ba71462caba2f29c2140
6
+ metadata.gz: 9c0a220f43a19fa785ed29c5d6123d65c9a2871d4c4bce45288892e5b75ea86bd1f80edb9b2d75b3d7829f7921e8259f5c0496f58e09956e5e40095d43f344ea
7
+ data.tar.gz: 21e381f3de987db40cc5c2c349fb9c8bbfc90845f0f2d81aa0ff08fd75eb98226e8bde70d478e414e142f3a88d227776e1df87b3f7a3ab56fc06be4e832d1c7a
@@ -21,7 +21,7 @@ Compatibility
21
21
 
22
22
  Supports mysql, mysql2, postgresql, and sqlite3.
23
23
 
24
- Currently tested against Rails 4.2.1, 4.2.0, 4.1.5, 4.0.9, 3.2.18, on Ruby 2.1.5.
24
+ Currently tested against Rails 4.2.3, 4.1.12, 4.0.13, 3.2.18, on Ruby 2.1.5.
25
25
 
26
26
  Was also previously tested compatible with 2.3.14, 3.0.17, and 3.1.8 on Ruby 2.0.0
27
27
  or 1.8.7 as appropriate, and may still work for them.
@@ -30,18 +30,28 @@ or 1.8.7 as appropriate, and may still work for them.
30
30
  Example
31
31
  =======
32
32
 
33
- # Example.all will exclude the file_data and processing_log columns from the
34
- # SELECT query, and example.file_data and example.processing_log will load & cache
35
- # that individual column value for the record instance.
36
- class Example
37
- columns_on_demand :file_data, :processing_log
38
- end
33
+ `Example.all` will exclude the `file_data` and `processing_log` columns from the
34
+ `SELECT` query, and `example.file_data` and `example.processing_log` will load & cache
35
+ that individual column value for the record instance:
39
36
 
40
- # Scans the 'examples' table columns and registers all TEXT (:text) and BLOB (:binary)
41
- # columns for loading on demand.
42
- class Example
43
- columns_on_demand
44
- end
37
+ ```ruby
38
+ class Example
39
+ columns_on_demand :file_data, :processing_log
40
+ end
41
+ ```
45
42
 
43
+ Scans the `examples` table columns and registers all TEXT (`:text`) and BLOB (`:binary`) columns for loading on demand:
44
+
45
+ ```ruby
46
+ class Example
47
+ columns_on_demand
48
+ end
49
+ ```
50
+
51
+ Thanks
52
+ ======
53
+
54
+ * Tim Connor (@tlconnor)
55
+ * Tobias Matthies (@tobmatth)
46
56
 
47
57
  Copyright (c) 2008-2015 Will Bryant, Sekuda Ltd, released under the MIT license
@@ -192,8 +192,7 @@ module ColumnsOnDemand
192
192
  if select_values.empty? && klass < ColumnsOnDemand::InstanceMethods
193
193
  arel.project(*arel_columns([default_select(true)]))
194
194
  else
195
- build_select_without_columns_on_demand(arel)
196
- arel.project(*arel_columns(select_values.uniq))
195
+ build_select_without_columns_on_demand(arel)
197
196
  end
198
197
  end
199
198
  end
@@ -1,3 +1,3 @@
1
1
  module ColumnsOnDemand
2
- VERSION = '4.2.1.1'
2
+ VERSION = '4.2.2'
3
3
  end
@@ -290,4 +290,11 @@ class ColumnsOnDemandTest < ActiveSupport::TestCase
290
290
  assert_not_loaded record, "data"
291
291
  assert_equal "replacement", record.data
292
292
  end
293
+
294
+ test "it doesn't create duplicate columns in SELECT queries" do
295
+ implicits = Arel::Table.new(:implicits)
296
+ reference_sql = implicits.project(implicits[:id]).to_sql
297
+ select_sql = Implicit.select("#{Implicit.quoted_table_name}.#{Implicit.connection.quote_column_name("id")}").to_sql
298
+ assert_equal select_sql, reference_sql
299
+ end
293
300
  end
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: 4.2.1.1
4
+ version: 4.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Bryant
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-17 00:00:00.000000000 Z
11
+ date: 2015-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -124,7 +124,7 @@ files:
124
124
  - ".gitignore"
125
125
  - Gemfile
126
126
  - MIT-LICENSE
127
- - README
127
+ - README.md
128
128
  - Rakefile
129
129
  - columns_on_demand.gemspec
130
130
  - init.rb