Class: ActionDispatch::Routing::Mapper::Resources::SingletonResource
  
  
  
  
  
    - Inherits:
 
    - 
      Resource
      
        
          - Object
 
          
            - Resource
 
          
            - ActionDispatch::Routing::Mapper::Resources::SingletonResource
 
          
        
        show all
      
     
  
  
  
  
  
  
  
  
  
  
    - Defined in:
 
    - actionpack/lib/action_dispatch/routing/mapper.rb
 
  
  
 
Overview
  
  Instance Attribute Summary
  
  Attributes inherited from Resource
  #controller, #param, #path
  
    
      Class Method Summary
      collapse
    
    
  
    
      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.
   
 
  
  
    
      
1287
1288
1289
1290
1291
1292 
     | 
    
      # File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1287
def initialize(entities, api_only, shallow, options)
  super
  @as         = nil
  @controller = (options[:controller] || plural).to_s
  @as         = options[:as]
end 
     | 
  
 
  
 
  
    Class Method Details
    
      
  
  
    .default_actions(api_only)  ⇒ Object 
  
  
  
  
    
      
1278
1279
1280
1281
1282
1283
1284 
     | 
    
      # File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1278
def default_actions(api_only)
  if api_only
    [:show, :create, :update, :destroy]
  else
    [:show, :create, :update, :destroy, :new, :edit]
  end
end
     | 
  
 
    
   
  
    Instance Method Details
    
      
  
  
    #default_actions  ⇒ Object 
  
  
  
  
    
      
1294
1295
1296 
     | 
    
      # File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1294
def default_actions
  self.class.default_actions(@api_only)
end 
     | 
  
 
    
      
  
  
    
      
1298
1299
1300 
     | 
    
      # File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1298
def plural
  @plural ||= name.to_s.pluralize
end 
     | 
  
 
    
      
  
  
    #singleton?  ⇒ Boolean 
  
  
  
  
    
      
1312 
     | 
    
      # File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1312
def singleton?; true; end 
     | 
  
 
    
      
  
  
    #singular  ⇒ Object 
  
  
    Also known as:
    member_name, collection_name
    
  
  
  
    
      
1302
1303
1304 
     | 
    
      # File 'actionpack/lib/action_dispatch/routing/mapper.rb', line 1302
def singular
  @singular ||= name.to_s
end 
     |