module Undercarriage::Controllers::Restful::NamespaceConcern

Namespace

Usage

class ExamplesController < ApplicationController
  include Undercarriage::Controllers::Restful::NamespaceConcern
end

Protected Instance Methods

resource_namespace() click to toggle source

Resource namespace

Best guess for namespace. Take `controller_path` and if there is more than one segment, assume the first is the namespace. When there is one segment, the namespace is `nil`

Example

# Override method that builds namespace
def resource_namespace
  :admin
end
# File lib/undercarriage/controllers/restful/namespace_concern.rb, line 33
def resource_namespace
  segments = controller_path.split('/')

  segments.length > 1 ? segments.first : nil
end