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 1434

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 1425

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 1459

def singleton?; true; end

Instance Method Details

#collection_name

Alias for #singular.

[ GitHub ]

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

alias :collection_name :singular

#default_actions

[ GitHub ]

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

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 1453

alias :member_name :singular

#member_scope

Alias for Resource#path.

[ GitHub ]

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

alias :member_scope :path

#nested_scope

Alias for Resource#path.

[ GitHub ]

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

alias :nested_scope :path

#plural

[ GitHub ]

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

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 1449

def singular
  @singular ||= name.to_s
end