pluck_all 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/README.md +11 -4
- data/Rakefile +1 -1
- data/{Gemfile → gemfiles/3.2.gemfile} +4 -1
- data/gemfiles/4.2.gemfile +7 -0
- data/gemfiles/5.0.gemfile +7 -0
- data/lib/pluck_all/version.rb +1 -1
- data/lib/pluck_all.rb +4 -1
- data/pluck_all.gemspec +6 -2
- metadata +49 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fbf4b38b67da03c65352ec3aa6776b624027b8b
|
4
|
+
data.tar.gz: eabbfd9ae17e6585c9920284f529dd99a1ffb896
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 388377043da7d8e06c36f5be9cbad60636cf62a577b4fc5485f12bd72bb620a252f29509240ae0311ffae55756429d6e6546be9a1fed2c687fb9e72d279296f6
|
7
|
+
data.tar.gz: e7728a28ef669709605bd571951a0305ee1d54055e7527945e216653a76921693fbd7d883767c132479ea6b5ee27bd7ca25ab72c7c10587d07e52d27dd7eab71
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/pluck_all.svg)](http://badge.fury.io/rb/pluck_all)
|
2
|
+
[![Build Status](https://travis-ci.org/khiav223577/pluck_all.svg?branch=master)](https://travis-ci.org/khiav223577/pluck_all)
|
3
|
+
|
1
4
|
# PluckAll
|
2
5
|
|
3
|
-
|
6
|
+
Plucking Multiple Columns in Rails 3. Also support in Rails 4, and Rails 5
|
4
7
|
|
5
|
-
|
8
|
+
If you have a rails 3 project, and want to pluck not only one column,
|
9
|
+
feel free to use this gem and no need to worry about upgrading to Rails 4 in the future will break this.
|
6
10
|
|
7
11
|
## Installation
|
8
12
|
|
@@ -22,7 +26,10 @@ Or install it yourself as:
|
|
22
26
|
|
23
27
|
## Usage
|
24
28
|
|
25
|
-
|
29
|
+
```rb
|
30
|
+
User.where(:id => [1,2]).pluck_all(:id, :account)
|
31
|
+
# => [{"id"=>1, "account"=>"account1"}, {"id"=>2, "account"=>"account2"}]
|
32
|
+
```
|
26
33
|
|
27
34
|
## Development
|
28
35
|
|
@@ -32,7 +39,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
39
|
|
33
40
|
## Contributing
|
34
41
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
42
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/khiav223577/pluck_all. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
43
|
|
37
44
|
|
38
45
|
## License
|
data/Rakefile
CHANGED
data/lib/pluck_all/version.rb
CHANGED
data/lib/pluck_all.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
require "pluck_all/version"
|
2
|
+
require 'rails'
|
3
|
+
require 'active_record'
|
2
4
|
|
3
5
|
class ActiveRecord::Base
|
4
6
|
if !defined?(attribute_types) && defined?(column_types)
|
@@ -54,7 +56,8 @@ private
|
|
54
56
|
end
|
55
57
|
relation = clone
|
56
58
|
relation.select_values = args
|
57
|
-
return klass.connection.select_all(relation.
|
59
|
+
return klass.connection.select_all(relation.to_sql)
|
60
|
+
#return klass.connection.select_all(relation.arel)
|
58
61
|
end
|
59
62
|
end
|
60
63
|
class ActiveRecord::Base
|
data/pluck_all.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["khiav reoy"]
|
10
10
|
spec.email = ["mrtmrt15xn@yahoo.com.tw"]
|
11
11
|
|
12
|
-
spec.summary = %q{Plucking Multiple Columns in Rails 3
|
13
|
-
|
12
|
+
spec.summary = %q{Plucking Multiple Columns in Rails 3. Also support in Rails 4, and Rails 5.}
|
13
|
+
spec.description = %q{If you have a rails 3 project, and want to pluck not only one column, feel free to use this gem and no need to worry about upgrading to Rails 4 in the future will break this.}
|
14
14
|
spec.homepage = "https://github.com/khiav223577/pluck_all"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
@@ -29,5 +29,9 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
spec.add_development_dependency "bundler", "~> 1.11"
|
31
31
|
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "sqlite3", "~> 1.3"
|
32
33
|
spec.add_development_dependency "minitest", "~> 5.0"
|
34
|
+
|
35
|
+
spec.add_dependency "rails", ">= 3"
|
36
|
+
|
33
37
|
end
|
metadata
CHANGED
@@ -1,73 +1,105 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pluck_all
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- khiav reoy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.11'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.11'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sqlite3
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: minitest
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - ~>
|
59
|
+
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '5.0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - ~>
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '5.0'
|
55
|
-
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3'
|
83
|
+
description: If you have a rails 3 project, and want to pluck not only one column,
|
84
|
+
feel free to use this gem and no need to worry about upgrading to Rails 4 in the
|
85
|
+
future will break this.
|
56
86
|
email:
|
57
87
|
- mrtmrt15xn@yahoo.com.tw
|
58
88
|
executables: []
|
59
89
|
extensions: []
|
60
90
|
extra_rdoc_files: []
|
61
91
|
files:
|
62
|
-
- .gitignore
|
63
|
-
- .travis.yml
|
92
|
+
- ".gitignore"
|
93
|
+
- ".travis.yml"
|
64
94
|
- CODE_OF_CONDUCT.md
|
65
|
-
- Gemfile
|
66
95
|
- LICENSE.txt
|
67
96
|
- README.md
|
68
97
|
- Rakefile
|
69
98
|
- bin/console
|
70
99
|
- bin/setup
|
100
|
+
- gemfiles/3.2.gemfile
|
101
|
+
- gemfiles/4.2.gemfile
|
102
|
+
- gemfiles/5.0.gemfile
|
71
103
|
- lib/pluck_all.rb
|
72
104
|
- lib/pluck_all/version.rb
|
73
105
|
- pluck_all.gemspec
|
@@ -81,18 +113,19 @@ require_paths:
|
|
81
113
|
- lib
|
82
114
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
115
|
requirements:
|
84
|
-
- -
|
116
|
+
- - ">="
|
85
117
|
- !ruby/object:Gem::Version
|
86
118
|
version: '0'
|
87
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
120
|
requirements:
|
89
|
-
- -
|
121
|
+
- - ">="
|
90
122
|
- !ruby/object:Gem::Version
|
91
123
|
version: '0'
|
92
124
|
requirements: []
|
93
125
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.
|
126
|
+
rubygems_version: 2.4.8
|
95
127
|
signing_key:
|
96
128
|
specification_version: 4
|
97
|
-
summary: Plucking Multiple Columns in Rails 3
|
129
|
+
summary: Plucking Multiple Columns in Rails 3. Also support in Rails 4, and Rails
|
130
|
+
5.
|
98
131
|
test_files: []
|