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

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

Overview

:nodoc:

Constant Summary

DEFAULT_ACTIONS =
[:show, :create, :update, :destroy, :new, :edit]

Instance Attribute Summary

Attributes inherited from Resource

#controller, #options, #path

Instance Method Summary (collapse)

Methods inherited from Resource

#actions, #default_actions, #name, #new_scope, #resource_scope

Constructor Details

- (SingletonResource) initialize(entities, options)



520
521
522
523
524
525
526
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 520

def initialize(entities, options)
  @name       = entities.to_s
  @path       = (options.delete(:path) || @name).to_s
  @controller = (options.delete(:controller) || plural).to_s
  @as         = options.delete(:as)
  @options    = options
end

Instance Method Details

- (Object) plural



528
529
530
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 528

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

- (Object) singular Also known as: member_name, collection_name



532
533
534
# File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 532

def singular
  @singular ||= name.to_s
end