| Class | Ardes::ResourcesController::SingletonSpecification |
| In: |
lib/ardes/resources_controller/specification.rb
|
| Parent: | Specification |
A Singleton Specification
Same as Specification except:
Options for unconvential use (otherwise these are all inferred from the name)
# File lib/ardes/resources_controller/specification.rb, line 85
85: def initialize(spec_name, options = {}, &block)
86: options[:segment] ||= spec_name.to_s
87: options[:source] ||= spec_name.to_s
88: options[:class] ||= (options[:source] || spec_name).to_s.camelize.constantize
89: super(spec_name, options, &block)
90: end
finds the resource from the enclosing resource. Raise CantFindSingleton if there is no enclosing resource
# File lib/ardes/resources_controller/specification.rb, line 98
98: def find_resource(controller)
99: ResourcesController.raise_cant_find_singleton(name, klass) unless controller.enclosing_resource
100: controller.enclosing_resource.send(source)
101: end