activerecord-pickin 0.9.0 → 0.9.1
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.
- data/Gemfile +2 -0
- data/README.md +5 -1
- data/lib/activerecord-pickin/relation.rb +8 -1
- data/lib/activerecord-pickin/version.rb +1 -1
- data/spec/spec_helper.rb +17 -0
- metadata +7 -5
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -18,7 +18,7 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
FromClass.relation.pickin(IntoClass, {
|
21
|
+
FromClass.relation.pickin(IntoClass, {select_override_column: value or column}, [ignore])
|
22
22
|
|
23
23
|
Example:
|
24
24
|
|
@@ -40,6 +40,10 @@ Example:
|
|
40
40
|
|
41
41
|
## Change log
|
42
42
|
|
43
|
+
### version 0.9.1
|
44
|
+
|
45
|
+
* fixes mysql not run bugs.
|
46
|
+
|
43
47
|
### version 0.9.0
|
44
48
|
|
45
49
|
* Release beta
|
@@ -18,11 +18,18 @@ module ActiveRecord
|
|
18
18
|
end
|
19
19
|
Arel::Attributes::Attribute.new(insert_arel, c)
|
20
20
|
end
|
21
|
+
insert_sql = insert_arel.to_sql
|
22
|
+
|
23
|
+
# Remove insert quote for only mysql adapters
|
24
|
+
if ['MySql', 'Mysql2'].include? @klass.connection.adapter_name
|
25
|
+
insert_sql = insert_arel.to_sql.delete!('`').gsub!('\'', '`')
|
26
|
+
end
|
21
27
|
|
22
28
|
select_column = self.get_select_column columns, override, ignore
|
23
29
|
self.select_values = []
|
24
30
|
select_arel = self.select(select_column)
|
25
|
-
|
31
|
+
|
32
|
+
@klass.connection.execute "#{insert_sql} #{select_arel.to_sql}"
|
26
33
|
end
|
27
34
|
|
28
35
|
def get_select_column target, override, ignore
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
9
|
+
config.run_all_when_everything_filtered = true
|
10
|
+
config.filter_run :focus
|
11
|
+
|
12
|
+
# Run specs in random order to surface order dependencies. If you find an
|
13
|
+
# order dependency and want to debug it, you can fix the order by providing
|
14
|
+
# the seed, which is printed after each run.
|
15
|
+
# --seed 1234
|
16
|
+
config.order = 'random'
|
17
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-pickin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
16
|
-
requirement: &
|
16
|
+
requirement: &70330124706600 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70330124706600
|
25
25
|
description: INSERT SELECT Query For ActiveRecord
|
26
26
|
email:
|
27
27
|
- info@miio.info
|
@@ -38,6 +38,7 @@ files:
|
|
38
38
|
- lib/activerecord-pickin.rb
|
39
39
|
- lib/activerecord-pickin/relation.rb
|
40
40
|
- lib/activerecord-pickin/version.rb
|
41
|
+
- spec/spec_helper.rb
|
41
42
|
homepage: ''
|
42
43
|
licenses: []
|
43
44
|
post_install_message:
|
@@ -62,4 +63,5 @@ rubygems_version: 1.8.11
|
|
62
63
|
signing_key:
|
63
64
|
specification_version: 3
|
64
65
|
summary: Can using INSERT SELECT
|
65
|
-
test_files:
|
66
|
+
test_files:
|
67
|
+
- spec/spec_helper.rb
|