Dynamic do Fusebox circuit.cfc style
I was just wondering if there is a difference between calling another fuseaction in a circuit.cfc using the two methods below:
Method 1:
Call another fuseaction in the same circuit using fusebox's dynamic do
<cfset myFusebox.do(action="list" ) />
Method 2:
Call another fuseaction function in the same cfc
<cfset List( myFusebox=myFusebox, event=event ) />
It turns out that the first method will call the prefuseaction and postfuseaction before executing the "list" fuse, the second method won't.
Thanks to Sean Corfield and Barney Boisevert.
- Posted in:
- ColdFusion
- Fusebox


Just wanted to add:
Method 2 is a behaviour similar to that of a subroutine in mach-ii while leaving it as a handler also. It also makes it easier to use the postfuseaction() to call layouts if your fuseactions are making use of multiple methods in your controller.
Comment by Matt – March 29, 2008
I have been using the postfuseaction method to call a super postfuseaction to handle layouts.
For example in posts.cfc which extends layout.cfc I have the following postfuseaction:
<cffunction name="postfuseaction" access="public" output="true" hint="I process post fuseaction execution">
<cfargument name="myFusebox" />
<cfargument name="event" />
<cfset super.postfuseaction(myFusebox=myFusebox, event=event) />
</cffunction>
The postfuseaction method in layout.cfc then simply calls:
<cfset myFusebox.do(action="vLayout.lay_clean") />
Comment by John Whish – March 29, 2008