Back
resources()
Create a group of routes that exposes actions for manipulating a collection of resources. A plural resource exposes URL patterns for the entire CRUD lifecycle (index
, show
, new
, create
, edit
, update
, delete
), exposing a primary key in the URL for showing, editing, updating, and deleting records. If you need to generate routes for manipulating a singular resource without a primary key, see the resource
mapper method.
<cfscript> mapper() // With default arguments .resources("admins") // Point authors URL to controller at `controllers/Users.cfc` .resources(name="authors", controller="users") // Limited list of routes generated by `only` argument. .resources(name="products", only="index,show,edit,update") // Limited list of routes generated by `except` argument. .resources(name="orders", except="delete") // Nested resources .resources(name="stories", nested=true) .resources("heroes") .resources("villains") .end() // Overridden `path` .resources(name="blogPostsOptions", path="blog-posts/options") .end(); </cfscript>
Copied!