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

Inherits:
Resource
  • Object
show all
Defined in:
lib/action_dispatch/routing/mapper.rb

Overview

:nodoc:

Constant Summary collapse

DEFAULT_ACTIONS =
[:show, :create, :update, :destroy, :new, :edit]

Instance Attribute Summary

Attributes inherited from Resource

#controller, #options, #path

Instance Method Summary collapse

Methods inherited from Resource

#actions, #default_actions, #name, #new_scope, #resource_scope

Constructor Details

#initialize(entities, options) ⇒ SingletonResource

Returns a new instance of SingletonResource.



947
948
949
950
951
952
953
# File 'lib/action_dispatch/routing/mapper.rb', line 947

def initialize(entities, options)
  super

  @as         = nil
  @controller = (options[:controller] || plural).to_s
  @as         = options[:as]
end

Instance Method Details

#pluralObject



955
956
957
# File 'lib/action_dispatch/routing/mapper.rb', line 955

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

#singularObject Also known as: member_name, collection_name



959
960
961
# File 'lib/action_dispatch/routing/mapper.rb', line 959

def singular
  @singular ||= name.to_s
end