Class Ardes::ResourcesController::SingletonSpecification
In: lib/ardes/resources_controller/specification.rb
Parent: Specification

A Singleton Specification

Methods

Public Class methods

Same as Specification except:

Options for unconvential use (otherwise these are all inferred from the name)

  • :source: a singular string or symbol (e.g. :blog). This is used to find the class or association name
  • :segment: (e.g. ‘blog’) the segment name in the route that is matched

[Source]

    # 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

Public Instance methods

finds the resource from the enclosing resource. Raise CantFindSingleton if there is no enclosing resource

[Source]

     # 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

returns true

[Source]

    # File lib/ardes/resources_controller/specification.rb, line 93
93:       def singleton?
94:         true
95:       end

[Validate]