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, #path

Instance Method Summary collapse

Methods inherited from Resource

#actions, #name, #new_scope, #resource_scope

Constructor Details

#initialize(entities, options) ⇒ SingletonResource

Returns a new instance of SingletonResource.



933
934
935
936
937
938
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 933

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

Instance Method Details

#default_actionsObject



940
941
942
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 940

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

#pluralObject



944
945
946
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 944

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

#singularObject Also known as: member_name, collection_name



948
949
950
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 948

def singular
  @singular ||= name.to_s
end