--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: "Creates named routes for implementing verb-oriented controllers for a singleton \\resource. A singleton \\resource is global to its current context. For unnested singleton \\resources, the \\resource is global to the current user visiting the application, such as a user's <tt>/account</tt> profile. For nested singleton \\resources, the \\resource is global to its parent \\resource, such as a <tt>projects</tt> \\resource that <tt>has_one :project_manager</tt>. The <tt>project_manager</tt> should be mapped as a singleton \\resource under <tt>projects</tt>:"
- !ruby/struct:SM::Flow::VERB 
  body: "  map.resources :projects do |project|\n    project.resource :project_manager\n  end\n"
- !ruby/struct:SM::Flow::P 
  body: "See <tt>resources</tt> for general conventions. These are the main differences:"
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: A singular name is given to <tt>map.resource</tt>. The default controller name is still taken from the plural name.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: To specify a custom plural name, use the <tt>:plural</tt> option. There is no <tt>:singular</tt> option.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: No default index route is created for the singleton \resource controller.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "When nesting singleton \\resources, only the singular name is used as the path prefix (example: 'account/messages/1')"
  type: :BULLET
- !ruby/struct:SM::Flow::P 
  body: "For example:"
- !ruby/struct:SM::Flow::VERB 
  body: "  map.resource :account\n"
- !ruby/struct:SM::Flow::P 
  body: "maps these actions in the Accounts controller:"
- !ruby/struct:SM::Flow::VERB 
  body: "  class AccountsController &lt; ActionController::Base\n    # GET new_account_url\n    def new\n      # return an HTML form for describing the new account\n    end\n\n    # POST account_url\n    def create\n      # create an account\n    end\n\n    # GET account_url\n    def show\n      # find and return the account\n    end\n\n    # GET edit_account_url\n    def edit\n      # return an HTML form for editing the account\n    end\n\n    # PUT account_url\n    def update\n      # find and update the account\n    end\n\n    # DELETE account_url\n    def destroy\n      # delete the account\n    end\n  end\n"
- !ruby/struct:SM::Flow::P 
  body: "Along with the routes themselves, <tt>resource</tt> generates named routes for use in controllers and views. <tt>map.resource :account</tt> produces these named routes and helpers:"
- !ruby/struct:SM::Flow::VERB 
  body: "  Named Route   Helpers\n  ============  =============================================\n  account       account_url, hash_for_account_url,\n                account_path, hash_for_account_path\n\n  new_account   new_account_url, hash_for_new_account_url,\n                new_account_path, hash_for_new_account_path\n\n  edit_account  edit_account_url, hash_for_edit_account_url,\n                edit_account_path, hash_for_edit_account_path\n"
full_name: ActionController::Resources#resource
is_singleton: false
name: resource
params: (*entities, &block)
visibility: public
