polo 0.4.1 → 0.5.0
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/Appraisals +4 -0
- data/CHANGELOG.md +10 -0
- data/gemfiles/rails50.gemfile +7 -0
- data/lib/polo/sql_translator.rb +26 -2
- data/lib/polo/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca29093a04bba002958e166ec8881900c45ca74c
|
4
|
+
data.tar.gz: a0039ac801dbc56df94c5533cbaae90da1e42e9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11938c67cf755be0cd4e22b0a7266daaf2cdc22b3aa3f3b86e4741b52ae476f30d679bbcfb7af690a79bee42ae6790f23912cc419777fdd2b177c31a7876b100
|
7
|
+
data.tar.gz: 6e4d16920f4fa794371c56ae089e063d65ef0c03133414e7eb16f9496bfa88c3b7e44d23a7b05e68441903e920ff386752ddba0cc9bb38679b55cdfe54196e81
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
data/lib/polo/sql_translator.rb
CHANGED
@@ -69,7 +69,7 @@ module Polo
|
|
69
69
|
# wouldn't be properly serialized automatically. That's why explict
|
70
70
|
# 'type_cast' call are necessary.
|
71
71
|
#
|
72
|
-
module
|
72
|
+
module ActiveRecordFour
|
73
73
|
def insert_values(record)
|
74
74
|
connection = ActiveRecord::Base.connection
|
75
75
|
values = record.send(:arel_attributes_with_values_for_create, record.attribute_names)
|
@@ -80,10 +80,34 @@ module Polo
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
+
# Internal: Returns an object's attribute definitions along with
|
84
|
+
# their set values (for Rails >= 5.x).
|
85
|
+
#
|
86
|
+
# Serializers have changed again in rails 5.
|
87
|
+
# We now use the type_caster from the arel_table.
|
88
|
+
#
|
89
|
+
module ActiveRecordFive
|
90
|
+
# Based on the codepath used in Rails 5
|
91
|
+
def raw_sql(record)
|
92
|
+
values = record.send(:arel_attributes_with_values_for_create, record.attribute_names)
|
93
|
+
model = record.class
|
94
|
+
substitutes, binds = model.unscoped.substitute_values(values)
|
95
|
+
|
96
|
+
insert_manager = model.arel_table.create_insert
|
97
|
+
insert_manager.insert substitutes
|
98
|
+
|
99
|
+
model.connection.unprepared_statement do
|
100
|
+
model.connection.to_sql(insert_manager, binds)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
83
105
|
if ActiveRecord::VERSION::MAJOR < 4
|
84
106
|
include ActiveRecordLessThanFour
|
107
|
+
elsif ActiveRecord::VERSION::MAJOR == 4
|
108
|
+
include ActiveRecordFour
|
85
109
|
else
|
86
|
-
|
110
|
+
prepend ActiveRecordFive
|
87
111
|
end
|
88
112
|
end
|
89
113
|
end
|
data/lib/polo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Netto Farah
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- gemfiles/rails40.gemfile
|
118
118
|
- gemfiles/rails41.gemfile
|
119
119
|
- gemfiles/rails42.gemfile
|
120
|
+
- gemfiles/rails50.gemfile
|
120
121
|
- lib/polo.rb
|
121
122
|
- lib/polo/adapters/mysql.rb
|
122
123
|
- lib/polo/adapters/postgres.rb
|
@@ -146,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
147
|
version: '0'
|
147
148
|
requirements: []
|
148
149
|
rubyforge_project:
|
149
|
-
rubygems_version: 2.4.
|
150
|
+
rubygems_version: 2.4.8
|
150
151
|
signing_key:
|
151
152
|
specification_version: 4
|
152
153
|
summary: Bring life back to your development environment with samples from production
|