simple_nested_set 0.1.6 → 0.1.7
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.
@@ -73,10 +73,26 @@ when /^2\.0\.[5-9]$/, /^2\.1\.[01]$/, '2.0.10'
|
|
73
73
|
attr_reader :options # this line is added
|
74
74
|
|
75
75
|
def initialize name, engine = Arel::Table.engine
|
76
|
-
@
|
77
|
-
|
76
|
+
@name = name.to_s
|
77
|
+
@engine = engine
|
78
|
+
@columns = nil
|
79
|
+
@aliases = []
|
80
|
+
@table_alias = nil
|
81
|
+
@primary_key = nil
|
82
|
+
|
83
|
+
if Hash === engine
|
84
|
+
@options = engine # this line has been added
|
85
|
+
@engine = engine[:engine] || Arel::Table.engine
|
86
|
+
@columns = attributes_for engine[:columns]
|
87
|
+
|
88
|
+
# Sometime AR sends an :as parameter to table, to let the table know
|
89
|
+
# that it is an Alias. We may want to override new, and return a
|
90
|
+
# TableAlias node?
|
91
|
+
@table_alias = engine[:as] unless engine[:as].to_s == @name
|
92
|
+
end
|
78
93
|
end
|
79
94
|
|
95
|
+
# this whole method is new
|
80
96
|
def as(table_alias)
|
81
97
|
@options ||= {}
|
82
98
|
Arel::Table.new(name, options.merge(:as => table_alias))
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_nested_set
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 7
|
10
|
+
version: 0.1.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sven Fuchs
|