activerecord-hierarchical_query 0.1.2 → 0.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3857ae3686fc8bc70d3fa51f68ce8b179c74565
|
4
|
+
data.tar.gz: 8ff21aff761065bdc8fe7af742607a53f1488b7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47ba81111606890e77d4decb8b1dcb8e9f10ae0ff985b74aab7309133c159294227bed679b7d748ee644aa4646fac8eb29404bee0cdfede1689f15a35dded15b
|
7
|
+
data.tar.gz: 2d474936f08750e56f9a467d07ef8bc110e099154907f260f31f579ffed75690c9f70c384e6ca3cc48bb61f56706a26ef1f06298808a1fba77cec5576b66f0ca
|
data/README.md
CHANGED
@@ -101,7 +101,12 @@ module ActiveRecord
|
|
101
101
|
table = order_attribute.relation
|
102
102
|
|
103
103
|
if table.engine == ActiveRecord::Base
|
104
|
-
columns =
|
104
|
+
columns =
|
105
|
+
if table.engine.connection.respond_to?(:schema_cache)
|
106
|
+
table.engine.connection.schema_cache.columns_hash(table.name)
|
107
|
+
else
|
108
|
+
table.engine.connection_pool.columns_hash[table.name]
|
109
|
+
end
|
105
110
|
else
|
106
111
|
columns = table.engine.columns_hash
|
107
112
|
end
|
@@ -110,4 +115,4 @@ module ActiveRecord
|
|
110
115
|
end
|
111
116
|
end
|
112
117
|
end
|
113
|
-
end
|
118
|
+
end
|
@@ -253,7 +253,7 @@ module ActiveRecord
|
|
253
253
|
#
|
254
254
|
# @return [Arel::Table]
|
255
255
|
def prior
|
256
|
-
@recursive_table ||= Arel::Table.new("#{
|
256
|
+
@recursive_table ||= Arel::Table.new("#{normalized_table_name}__recursive")
|
257
257
|
end
|
258
258
|
alias_method :previous, :prior
|
259
259
|
alias_method :recursive_table, :prior
|
@@ -308,7 +308,7 @@ module ActiveRecord
|
|
308
308
|
raise 'Recursive query requires CONNECT BY clause, please use #connect_by method' unless
|
309
309
|
connect_by_value
|
310
310
|
|
311
|
-
table_alias = join_options.fetch(:as, "#{
|
311
|
+
table_alias = join_options.fetch(:as, "#{normalized_table_name}__recursive")
|
312
312
|
|
313
313
|
JoinBuilder.new(self, relation, table_alias, join_options).build
|
314
314
|
end
|
@@ -325,6 +325,10 @@ module ActiveRecord
|
|
325
325
|
end.reduce(:and)
|
326
326
|
end
|
327
327
|
end
|
328
|
+
|
329
|
+
def normalized_table_name
|
330
|
+
table.name.gsub('.', '_')
|
331
|
+
end
|
328
332
|
end # class Builder
|
329
333
|
end # module HierarchicalQuery
|
330
334
|
end # module ActiveRecord
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'active_record/hierarchical_query'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-hierarchical_query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexei Mikhailov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- lib/active_record/hierarchical_query/orderings.rb
|
121
121
|
- lib/active_record/hierarchical_query/query.rb
|
122
122
|
- lib/active_record/hierarchical_query/version.rb
|
123
|
+
- lib/activerecord-hierarchical_query.rb
|
123
124
|
- lib/arel/nodes/postgresql.rb
|
124
125
|
- spec/active_record/hierarchical_query_spec.rb
|
125
126
|
- spec/database.travis.yml
|