Class: ActionDispatch::Routing::Mapper::Resources::SingletonResource
- Inherits:
-
Resource
- Object
- Resource
- ActionDispatch::Routing::Mapper::Resources::SingletonResource
- 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
Instance Method Summary collapse
-
#initialize(entities, options) ⇒ SingletonResource
constructor
A new instance of SingletonResource.
- #plural ⇒ Object
- #singular ⇒ Object (also: #member_name, #collection_name)
Methods inherited from Resource
#actions, #default_actions, #name, #new_scope, #resource_scope
Constructor Details
#initialize(entities, options) ⇒ SingletonResource
Returns a new instance of SingletonResource.
857 858 859 860 861 862 863 |
# File 'lib/action_dispatch/routing/mapper.rb', line 857 def initialize(entities, ) @name = entities.to_s @path = (.delete(:path) || @name).to_s @controller = (.delete(:controller) || plural).to_s @as = .delete(:as) @options = end |
Instance Method Details
#plural ⇒ Object
865 866 867 |
# File 'lib/action_dispatch/routing/mapper.rb', line 865 def plural @plural ||= name.to_s.pluralize end |
#singular ⇒ Object Also known as: member_name, collection_name
869 870 871 |
# File 'lib/action_dispatch/routing/mapper.rb', line 869 def singular @singular ||= name.to_s end |