Module: DryCrud::Nestable

Included in:
ListController
Defined in:
app/controllers/dry_crud/nestable.rb

Overview

Provides functionality to nest controllers/resources. If a controller is nested, the parent classes and namespaces may be defined as an array in the nesting class attribute.

For example, a cities controller, nested in country and a admin namespace, may define this attribute as follows:

self.nesting = :admin, Country

Class Method Summary collapse

Class Method Details

.prepended(klass) ⇒ Object

Adds the :nesting class attribute and parent helper methods to the including controller.



14
15
16
17
18
# File 'app/controllers/dry_crud/nestable.rb', line 14

def self.prepended(klass)
  klass.class_attribute :nesting

  klass.helper_method :parent, :parents
end