Module: Puffer::Extensions::Mapper

Extended by:
ActiveSupport::Concern
Defined in:
lib/puffer/extensions/mapper.rb

Overview

Extends rails mapper to provide resources nesting tree structure with request params. Route defaults contains :puffer key with node index in resources tree nodes array. See Puffer::Resource::Tree

Resource tree depends on routes resources nesting.

ex:

namespace :admin do
  resources :users do
    resource :profile
    resources :articles
  end
  resources :orders
end

will produce:

[
  {:scope => 'admin', :current => :users, :children => [:profile, :articles], :ancestors => []},
  {:scope => 'admin', :current => :profile, :children => [], :ancestors => [:users]},
  {:scope => 'admin', :current => :articles, :children => [], :ancestors => [:users]},
  {:scope => 'admin', :current => :orders, :children => [], :ancestors => []},
]

a complete tree structure with nodes array to acces with node index (Puffer::Resource::Tree#to_struct).

Also this mapper extension adds come aaditional routes for every pufer controller and namespace.

Defined Under Namespace

Modules: InstanceMethods