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

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

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Resource

#controller, #options, #param, #path

Instance Method Summary collapse

Methods inherited from Resource

#actions, #name, #nested_param, #new_scope, #resource_scope, #shallow=, #shallow?

Constructor Details

#initialize(entities, options) ⇒ SingletonResource

Returns a new instance of SingletonResource.



1088
1089
1090
1091
1092
1093
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1088

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

Instance Method Details

#default_actionsObject



1095
1096
1097
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1095

def default_actions
  [:show, :create, :update, :destroy, :new, :edit]
end

#pluralObject



1099
1100
1101
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1099

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

#singularObject Also known as: member_name, collection_name



1103
1104
1105
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1103

def singular
  @singular ||= name.to_s
end