sql_pluck 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sql_pluck.rb +2 -15
- data/sql_pluck.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e593575f7b2b7f0b1c48be492893a4d3d5f187c3432f65d3e2823630fc2bb22b
|
4
|
+
data.tar.gz: 8b866881c4072ed6770773cb50489f0aaf159fd1a96d969cd4b8b1a59ffd1bd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f731a4b70ded526a4d038c61baa86760d1f161e52e831e72e05bf1cbcec5152e69209ce757b41f8a87766225103b409c2c956361e8f5e1d0527e22bd7d662d15
|
7
|
+
data.tar.gz: e07327f6d7e1ddb63e2cebcd87fcff97e56b222bb40cd66fa44f60f3ea81fed35c99c8c7c108a6ed02000f7ebcde2bc7bee68eaf20ed395d2d0cef1df84cd11c
|
data/lib/sql_pluck.rb
CHANGED
@@ -14,20 +14,7 @@ module SQLPluck
|
|
14
14
|
# like .pluck method.
|
15
15
|
#
|
16
16
|
def pluck_by_sql(sql, binds = [])
|
17
|
-
|
18
|
-
|
19
|
-
rs.map {|record| cast_record(record, types) }
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def cast_record(record, types)
|
25
|
-
record.map {|name, string| types[name].type_cast(string) }
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
if defined?(ActiveRecord::Type)
|
30
|
-
class ActiveRecord::Type::Value # reopen
|
31
|
-
public :type_cast
|
17
|
+
result = connection.select_all(sanitize_sql(sql), "#{name} Load", binds)
|
18
|
+
result.cast_values(result.column_types)
|
32
19
|
end
|
33
20
|
end
|
data/sql_pluck.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.platform = Gem::Platform::RUBY
|
3
3
|
s.name = 'sql_pluck'
|
4
|
-
s.version = '
|
4
|
+
s.version = '2.0.0'
|
5
5
|
s.summary = 'Provide #pluck_by_sql for Rails ActiveRecord models'
|
6
6
|
s.license = 'MIT'
|
7
7
|
|
@@ -12,5 +12,5 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
|
13
13
|
s.require_path = 'lib'
|
14
14
|
|
15
|
-
s.add_dependency 'activerecord', '~>
|
15
|
+
s.add_dependency 'activerecord', '~> 5.0'
|
16
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sql_pluck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Minero Aoki
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '5.0'
|
27
27
|
description:
|
28
28
|
email: aamine@loveruby.net
|
29
29
|
executables: []
|