inherited_resources_helpers 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- symbols.inject([]) do |parents, symbol|
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 respond_to?(name, include_private = false)
47
- self.class.resource_accessor?(name) || super
48
- end
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
@@ -1,3 +1,3 @@
1
1
  module InheritedResourcesHelpers
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  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: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
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-12 00:00:00 +02:00
18
+ date: 2010-09-13 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21