e9_rails 0.0.9 → 0.0.10
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/lib/e9_rails/active_record/sti.rb +1 -10
- data/lib/e9_rails/version.rb +1 -1
- metadata +2 -2
|
@@ -9,16 +9,7 @@ module E9Rails::ActiveRecord
|
|
|
9
9
|
|
|
10
10
|
module ClassMethods
|
|
11
11
|
def subclasses
|
|
12
|
-
|
|
13
|
-
# TODO is there a simpler, existing way of finding subclass types with STI
|
|
14
|
-
|
|
15
|
-
# TODO make this work with the new arel rewrite (#map is no longer a method)
|
|
16
|
-
#klasses = arel_table.project(Arel::Distinct.new(arel_table[:type])).map {|r| r.tuple.first }
|
|
17
|
-
klasses = connection.select_values("select distinct(type) from #{table_name}")
|
|
18
|
-
klasses.map! {|k| k.constantize rescue next }
|
|
19
|
-
klasses.compact!
|
|
20
|
-
klasses
|
|
21
|
-
end
|
|
12
|
+
descendants
|
|
22
13
|
end
|
|
23
14
|
|
|
24
15
|
def subclasses_with_ancestor(mod)
|
data/lib/e9_rails/version.rb
CHANGED
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: e9_rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease:
|
|
5
|
-
version: 0.0.
|
|
5
|
+
version: 0.0.10
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Travis Cox
|
|
@@ -10,7 +10,7 @@ autorequire:
|
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
12
|
|
|
13
|
-
date: 2011-
|
|
13
|
+
date: 2011-05-02 00:00:00 -04:00
|
|
14
14
|
default_executable:
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|