Skip to content

Instantly share code, notes, and snippets.

@davejlong
Created February 11, 2011 20:26
Show Gist options
  • Save davejlong/822958 to your computer and use it in GitHub Desktop.
Save davejlong/822958 to your computer and use it in GitHub Desktop.
This is my new conventian to comment CRUD controllers in my CFCs
<cfcomponent extends="Controller">
<!---Crud #### Create methods #### --->
<cffunction name="new">
<cfset user = model('user').new() />
</cffunction>
<cffunction name="create">
<cfset model('user').create(params.user) />
<cfset redirectTo(action="index",success="User #user.name# created successfully.") />
</cffunction>
<!---cRud #### Read methods #### --->
<cffunction name="index">
<cfset users = model('user').findAll(order='name');
</cffunction>
<!---crUd #### Update Methods #### --->
<!---cruD #### Delete methods #### --->
</cfcomponent>
@davejlong
Copy link
Author

It makes it (1) really easy to find CRUD methods in CFCs and (2) really easy to find each individual CRUD function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment