active_record_schema 0.5.7 → 0.5.8
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/VERSION +1 -1
- data/active_record_schema.gemspec +1 -1
- data/lib/active_record_schema/dsl.rb +2 -8
- data/lib/active_record_schema/schema.rb +11 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.8
|
@@ -4,14 +4,8 @@ module ActiveRecordSchema
|
|
4
4
|
module Dsl
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
module ClassMethods
|
7
|
-
|
8
|
-
def schema
|
9
|
-
# if self.superclass != ActiveRecord::Base
|
10
|
-
# table_holder = self.ancestors.find {|c| c.is_a?(Class) && c.superclass == ActiveRecord::Base}
|
11
|
-
# table_holder.schema
|
12
|
-
# else
|
13
|
-
# end
|
14
|
-
|
7
|
+
|
8
|
+
def schema
|
15
9
|
@active_record_schema_schema ||= ActiveRecordSchema::Schema.new(self)
|
16
10
|
|
17
11
|
end # ~ schema
|
@@ -15,6 +15,17 @@ module ActiveRecordSchema
|
|
15
15
|
@indexes = {}
|
16
16
|
@joins = {}
|
17
17
|
end
|
18
|
+
|
19
|
+
def hierarchy_fields
|
20
|
+
if @hierarchy_fields
|
21
|
+
@hierarchy_fields
|
22
|
+
else
|
23
|
+
@hierarchy_fields ||= ActiveSupport::OrderedHash.new
|
24
|
+
self.ancestors.select { |c| c.is_a?(Class) && c.superclass == ActiveRecord::Base }.reverse_each do |klass|
|
25
|
+
@hierarchy_fields = @hierarchy_fields.merge(klass.fields)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
18
29
|
|
19
30
|
def field_names
|
20
31
|
fields.values.map(&:name).map(&:to_s)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -86,7 +86,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
86
|
version: '0'
|
87
87
|
segments:
|
88
88
|
- 0
|
89
|
-
hash:
|
89
|
+
hash: 3702613398432765162
|
90
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
91
|
none: false
|
92
92
|
requirements:
|