123456789_123456789_123456789_123456789_123456789_

Class: ActionDispatch::Routing::Mapper::Resources::SingletonResource

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Resource
Instance Chain:
self, Resource
Inherits: ActionDispatch::Routing::Mapper::Resources::Resource
Defined in: actionpack/lib/action_dispatch/routing/mapper.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Resource - Inherited

#actions, #available_actions,
#collection_name

Checks for uncountable plurals, and appends “_index” if the plural and singular form are the same.

#default_actions,
#member_name
#member_scope, #name, #nested_param, #nested_scope, #new_scope, #plural, #resource_scope,
#shallow_scope
#singular

Constructor Details

.new(entities, api_only, shallow, options) ⇒ SingletonResource

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1271

def initialize(entities, api_only, shallow, options)
  super
  @as         = nil
  @controller = (options[:controller] || plural).to_s
  @as         = options[:as]
end

Instance Attribute Details

#singleton?Boolean (readonly)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1300

def singleton?; true; end

Instance Method Details

#collection_name

Alias for #singular.

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1295

alias :collection_name :singular

#default_actions

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1278

def default_actions
  if @api_only
    [:show, :create, :update, :destroy]
  else
    [:show, :create, :update, :destroy, :new, :edit]
  end
end

#member_name

Alias for #singular.

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1294

alias :member_name :singular

#member_scope

Alias for Resource#path.

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1297

alias :member_scope :path

#nested_scope

Alias for Resource#path.

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1298

alias :nested_scope :path

#plural

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1286

def plural
  @plural ||= name.to_s.pluralize
end

#singular Also known as: #member_name, #collection_name

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1290

def singular
  @singular ||= name.to_s
end