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

Inherits:
Resource
  • Object
show all
Defined in:
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

Constructor Details

#initialize(entities, options) ⇒ SingletonResource

Returns a new instance of SingletonResource.



1028
1029
1030
1031
1032
1033
# File 'lib/action_dispatch/routing/mapper.rb', line 1028

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

Instance Method Details

#default_actionsObject



1035
1036
1037
# File 'lib/action_dispatch/routing/mapper.rb', line 1035

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

#pluralObject



1039
1040
1041
# File 'lib/action_dispatch/routing/mapper.rb', line 1039

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

#singularObject Also known as: member_name, collection_name



1043
1044
1045
# File 'lib/action_dispatch/routing/mapper.rb', line 1043

def singular
  @singular ||= name.to_s
end