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

Constructor Details

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

[ GitHub ]

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

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

Class Method Details

.default_actions(api_only)

[ GitHub ]

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

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

Instance Attribute Details

#singleton?Boolean (readonly)

[ GitHub ]

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

def singleton?; true; end

Instance Method Details

#collection_name

Alias for #singular.

[ GitHub ]

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

alias :collection_name :singular

#default_actions

[ GitHub ]

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

def default_actions
  self.class.default_actions(@api_only)
end

#member_name

Alias for #singular.

[ GitHub ]

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

alias :member_name :singular

#member_scope

Alias for Resource#path.

[ GitHub ]

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

alias :member_scope :path

#nested_scope

Alias for Resource#path.

[ GitHub ]

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

alias :nested_scope :path

#plural

[ GitHub ]

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

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 1301

def singular
  @singular ||= name.to_s
end