order_as_specified 1.2 → 1.3

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: 69bf1783284bb4738f7c5a3d189e122d3f5f00a2
4
- data.tar.gz: 6c9f53fe8658d25a1d44dc9cd120d8eda8d62537
3
+ metadata.gz: 450073ab184ee65a4ca822e1357d3b83ef9f77c8
4
+ data.tar.gz: 2b82f44edfb67e15ebd24226a1222eabf18bb008
5
5
  SHA512:
6
- metadata.gz: 9f971220e0601e197de6ca6d16e5275db283f9d4c895953801220c527725242dd6a6401e94d73346555b4e0c7548893403dfc6538a91d8db9baf796db6aa13fa
7
- data.tar.gz: 8f9dba4933b6c521c4a7dbfdbac6c7a23e2bd374151862ee1166ef2c916ebfa2dcf1a02975f3d51ec0abff5ca27002ec7ea5eb143546480cc3c21bdf50166777
6
+ metadata.gz: f8719ccfaf980a2f5bd52535700a3093d96a41f2c5194f9edc1f5862a6c37cf801d0ceeda90a7a3c8e883532ca47e3595bc0657e07cf8e9864c66044f6d6bda7
7
+ data.tar.gz: 26fe666d64943d02e93a78fd6edb506480c4deaa8c3a1b6a5e675c98a81fd28082008209c578313dd8acb801a9b21fbe946b7e26c7d3d3cbcc71420abbd084c1
data/.travis.yml CHANGED
@@ -13,6 +13,7 @@ env:
13
13
  matrix:
14
14
  - AR_VERSION="~> 4.2.0"
15
15
  - AR_VERSION="~> 5.0.0"
16
+ - AR_VERSION="~> 5.1.0"
16
17
  notifications:
17
18
  email: false
18
19
  hipchat:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # 1.3
2
+
3
+ This release adds support for ActiveRecord 5.1. Many thanks to
4
+ [cohki0305](https://github.com/cohki0305) for identifying the issue,
5
+ [Billy Ferguson](https://github.com/fergyfresh) for investigating it, and
6
+ especially to [Alex Heeton](https://github.com/heeton) for fixing it.
7
+
1
8
  # 1.2
2
9
 
3
10
  This release contains an important change: `order_as_specified` is no longer
@@ -1,3 +1,3 @@
1
1
  module OrderAsSpecified
2
- VERSION = "1.2"
2
+ VERSION = "1.3"
3
3
  end
@@ -19,11 +19,12 @@ module OrderAsSpecified
19
19
  # We have to explicitly quote for now because SQL sanitization for ORDER BY
20
20
  # queries isn't in less current versions of Rails.
21
21
  # See: https://github.com/rails/rails/pull/13008
22
+ db_connection = ActiveRecord::Base.connection
22
23
  conditions = params[:values].map do |value|
23
24
  raise OrderAsSpecified::Error, "Cannot order by `nil`" if value.nil?
24
25
 
25
26
  # Sanitize each value to reduce the risk of SQL injection.
26
- "#{table}.#{attribute}=#{sanitize(value)}"
27
+ "#{table}.#{attribute}=#{db_connection.quote(value)}"
27
28
  end
28
29
 
29
30
  scope = order(conditions.map { |cond| "#{cond} DESC" }.join(", "))
@@ -1,6 +1,10 @@
1
- class TestSetupMigration < ActiveRecord::Migration
1
+ VersionedMigration = ActiveRecord::Migration.try(:[], 5.0) || ActiveRecord::Migration
2
+
3
+ class TestSetupMigration < VersionedMigration
2
4
  def up
3
- return if ActiveRecord::Base.connection.data_source_exists?(:test_classes)
5
+ db_connection = ActiveRecord::Base.connection
6
+ return if db_connection.try(:table_exists?,:test_classes) || # AR 4.2
7
+ db_connection.try(:data_source_exists?,:test_classes) # AR > 5.0
4
8
 
5
9
  create_table :test_classes do |t|
6
10
  t.string :field
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: order_as_specified
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.2'
4
+ version: '1.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Evelyn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-13 00:00:00.000000000 Z
11
+ date: 2017-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord