Class: ActionDispatch::Routing::Mapper::Resources::SingletonResource
- Inherits:
-
Resource
- Object
- Resource
- ActionDispatch::Routing::Mapper::Resources::SingletonResource
show all
- Defined in:
- lib/action_dispatch/routing/mapper.rb
Overview
Instance Attribute Summary
Attributes inherited from Resource
#controller, #param, #path
Instance Method Summary
collapse
Methods inherited from Resource
#actions, #available_actions, #name, #nested_param, #new_scope, #resource_scope, #shallow?
Constructor Details
#initialize(entities, api_only, shallow, options) ⇒ SingletonResource
Returns a new instance of SingletonResource.
1237
1238
1239
1240
1241
1242
|
# File 'lib/action_dispatch/routing/mapper.rb', line 1237
def initialize(entities, api_only, shallow, options)
super
@as = nil
@controller = (options[:controller] || plural).to_s
@as = options[:as]
end
|
Instance Method Details
#default_actions ⇒ Object
1244
1245
1246
1247
1248
1249
1250
|
# File 'lib/action_dispatch/routing/mapper.rb', line 1244
def default_actions
if @api_only
[:show, :create, :update, :destroy]
else
[:show, :create, :update, :destroy, :new, :edit]
end
end
|
#plural ⇒ Object
1252
1253
1254
|
# File 'lib/action_dispatch/routing/mapper.rb', line 1252
def plural
@plural ||= name.to_s.pluralize
end
|
#singleton? ⇒ Boolean
1266
|
# File 'lib/action_dispatch/routing/mapper.rb', line 1266
def singleton?; true; end
|
#singular ⇒ Object
Also known as:
member_name, collection_name
1256
1257
1258
|
# File 'lib/action_dispatch/routing/mapper.rb', line 1256
def singular
@singular ||= name.to_s
end
|