active_record_composition 0.0.2 → 0.0.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.
- data/lib/active_record_composition.rb +15 -5
- metadata +3 -3
@@ -22,11 +22,11 @@ module ActiveRecordComposition
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def method_missing(method, *args, &block)
|
25
|
-
begin
|
25
|
+
#begin
|
26
26
|
active_composite.send method, *args, &block
|
27
|
-
rescue
|
28
|
-
super.method_missing method, *args, &block
|
29
|
-
end
|
27
|
+
#rescue
|
28
|
+
#super.method_missing method, *args, &block
|
29
|
+
#end
|
30
30
|
end
|
31
31
|
|
32
32
|
end
|
@@ -38,7 +38,17 @@ module ActiveRecordComposition
|
|
38
38
|
|
39
39
|
def self.included(base)
|
40
40
|
base.extend(ClassMethods)
|
41
|
-
base.active_composite = create_class("#{base.name}", ActiveRecord::Base)
|
41
|
+
base.active_composite = self.create_class("#{base.name}ActiveComposite", ActiveRecord::Base) do
|
42
|
+
|
43
|
+
def is_a?(compared)
|
44
|
+
return true if self.class.name.gsub('ActiveComposite','') == compared.name
|
45
|
+
return true if compared.name == 'ActiveRecord::Base'
|
46
|
+
return true if self.class.name == compared.name
|
47
|
+
return false
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
base.active_composite.table_name = "#{base.name}s".underscore
|
42
52
|
end
|
43
53
|
|
44
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_composition
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-02-24 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
16
|
-
requirement: &
|
16
|
+
requirement: &9086080 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 3.2.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *9086080
|
25
25
|
description: ActiveRecord is awesome, inheritance is not always so awesome. This gem
|
26
26
|
is for people who want to use ActiveRecord but don't want to be forced to use inheritance
|
27
27
|
of ActiveRecord:Base in their models. Magic stuff happens that keeps the ActiveRecord::Base
|