module ActionDispatch::Routing::Mapper::Resources

def resource(*resources, &block)

Takes same options as resources[rdoc-ref:#resources]
=== Options

form_with(model: @profile) {}
# Enables this to work with singular routes:

resolve('Profile') { [:profile] }
resource :profile

will need to call resolve[rdoc-ref:CustomUrls#resolve]:
record identification (e.g. in +form_with+ or +redirect_to+), you
If you want instances of a model to work with this resource via

POST /profile
DELETE /profile
PATCH/PUT /profile
GET /profile/edit
GET /profile
GET /profile/new

the plural):
the +Profiles+ controller (note that the controller is named after
This creates six different routes in your application, all mapping to

resource :profile

the show action:
a singular resource to map /profile (rather than /profile/:id) to
profile of the currently logged in user. In this case, you can use
referencing an ID. A common example, /profile always shows the
Sometimes, you have a resource that clients always look up without
def resource(*resources, &block)
  options = resources.extract_options!.dup
  if apply_common_behavior_for(:resource, resources, options, &block)
    return self
  end
  with_scope_level(:resource) do
    options = apply_action_options options
    resource_scope(SingletonResource.new(resources.pop, api_only?, @scope[:shallow], options)) do
      yield if block_given?
      concerns(options[:concerns]) if options[:concerns]
      new do
        get :new
      end if parent_resource.actions.include?(:new)
      set_member_mappings_for_resource
      collection do
        post :create
      end if parent_resource.actions.include?(:create)
    end
  end
  self
end