inherited_resources_helpers 0.0.6 → 0.0.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.
@@ -6,9 +6,16 @@ module InheritedResources
|
|
6
6
|
end
|
7
7
|
|
8
8
|
module ClassMethods
|
9
|
+
def begin_of_association_chain(symbol)
|
10
|
+
resources_configuration[:self][:begin_of_association_chain] = symbol
|
11
|
+
define_method(:_begin_of_association_chain) { send(symbol) }
|
12
|
+
end
|
13
|
+
|
9
14
|
def define_resource_accessors(controller)
|
10
15
|
symbols = parents_symbols + [:self]
|
11
|
-
|
16
|
+
targets = [resources_configuration[:self][:begin_of_association_chain]].compact
|
17
|
+
|
18
|
+
symbols.uniq.inject(targets) do |parents, symbol|
|
12
19
|
config = resources_configuration[symbol]
|
13
20
|
name = symbol == :self ? config[:instance_name] : symbol
|
14
21
|
|
@@ -43,13 +50,9 @@ module InheritedResources
|
|
43
50
|
end
|
44
51
|
end
|
45
52
|
|
46
|
-
def
|
47
|
-
self.class.
|
48
|
-
|
49
|
-
|
50
|
-
def method_missing(name, *args, &block)
|
51
|
-
self.class.define_resource_accessors(self) unless self.class.resource_accessors_defined?
|
52
|
-
respond_to?(name) ? send(name) : super
|
53
|
+
def initialize(*)
|
54
|
+
self.class.define_resource_accessors(self)
|
55
|
+
super
|
53
56
|
end
|
54
57
|
end
|
55
58
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inherited_resources_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sven Fuchs
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-13 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|