order_as_specified 1.2 → 1.3
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/.travis.yml +1 -0
- data/CHANGELOG.md +7 -0
- data/lib/order_as_specified/version.rb +1 -1
- data/lib/order_as_specified.rb +2 -1
- data/spec/config/test_setup_migration.rb +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 450073ab184ee65a4ca822e1357d3b83ef9f77c8
|
4
|
+
data.tar.gz: 2b82f44edfb67e15ebd24226a1222eabf18bb008
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8719ccfaf980a2f5bd52535700a3093d96a41f2c5194f9edc1f5862a6c37cf801d0ceeda90a7a3c8e883532ca47e3595bc0657e07cf8e9864c66044f6d6bda7
|
7
|
+
data.tar.gz: 26fe666d64943d02e93a78fd6edb506480c4deaa8c3a1b6a5e675c98a81fd28082008209c578313dd8acb801a9b21fbe946b7e26c7d3d3cbcc71420abbd084c1
|
data/.travis.yml
CHANGED
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
|
data/lib/order_as_specified.rb
CHANGED
@@ -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}=#{
|
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
|
-
|
1
|
+
VersionedMigration = ActiveRecord::Migration.try(:[], 5.0) || ActiveRecord::Migration
|
2
|
+
|
3
|
+
class TestSetupMigration < VersionedMigration
|
2
4
|
def up
|
3
|
-
|
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.
|
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:
|
11
|
+
date: 2017-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|