cfinclude in recource/some.cfc

33 views
Skip to first unread message

Tim Vanderlois

unread,
Feb 18, 2015, 12:06:57 PM2/18/15
to taffy...@googlegroups.com
I have a "get" method that is generic for several of my resource endpoints... and instead of copy/paste the code I wanted to cfinclude.

Problem is the dashboard does not recognize the get method. Is there some other way to include a reusable method?

Example: 

resource.cfc
<cfcomponent extends="taffy.core.resource" taffy:uri="/listItems/" >
<cfinclude template="/cfm/get.cfm">
</cfcomponent>

-----------------------------------------------------
get.cfm
<cffunction name="get">
<cfreturn  noData().withStatus(200,"got here")>
</cffunction>

Adam Tuttle

unread,
Feb 18, 2015, 1:15:15 PM2/18/15
to taffy...@googlegroups.com
I've never tried using mixins before, but it should work with an intermediate class:

common.cfc:
component extends="taffy.core.resource" {

function get(){ /* your common code here */ }

}

Then each resource can extend common, to inherit the GET function.

Adam

--
You received this message because you are subscribed to the Google Groups "Taffy Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to taffy-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tim Vanderlois

unread,
Feb 18, 2015, 2:35:32 PM2/18/15
to taffy...@googlegroups.com
Although I do like your option better, still no luck getting it to work in the dashboard. 

--
You received this message because you are subscribed to a topic in the Google Groups "Taffy Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/taffy-users/mh00_BzsIgU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to taffy-users...@googlegroups.com.

Adam Tuttle

unread,
Feb 18, 2015, 3:31:00 PM2/18/15
to taffy...@googlegroups.com
Please file a bug report, that's something we'll definitely want to support.

In the short term, you can write a wrapper: function get(arg1, arg2){ return super.get(arg1, arg2); }

Adam
Reply all
Reply to author
Forward
0 new messages