routes [variable] called in controller needs params.id (1.1 RC1)

11 views
Skip to first unread message

Mike Henke

unread,
Nov 2, 2010, 3:27:05 PM11/2/10
to ColdFusion on Wheels
ok so I guess I am not done for the day :-) Anyone see this behavior
or am I crazy again :-)

I guess in 1.0.5, a route variable was placed in the variables scope
but in 1.1 RC1 it is placed in the variables.params structure?

Example
routes.cfm
<cfset addRoute(name="fundingbytype", pattern="foa/type/[id]",
controller="foa", action="fundingbytype") />

I had to add the params for the id.

<cffunction name="fundingbytype">
<!--- make sure id is only one of the approved types --->
<cfset var typeList = model("fundingtype").getFundingTypesList() />
<cfif not ListFind(ucase(typeList), ucase(params.id))>
.............
</cffunction>

Mike Henke

unread,
Nov 2, 2010, 3:46:21 PM11/2/10
to ColdFusion on Wheels
I like 1.1 RC1 handling of the routes variable since the route
variable doesn't bleed into the variables scope. I found several
places in my code I was using params.RouteVariable and others where I
was using RoutesVariable. This "enhancement" helps me be more clear
with my code.

If this behavior is verified with someone else, it should be put into
the upgrading doc. http://cfwheels.org/docs/1-1/chapter/upgrading-wheels

Per Djurner

unread,
Nov 3, 2010, 5:05:53 AM11/3/10
to cfwh...@googlegroups.com
I don't think this needs to be added to the upgrade instructions since
the documented approach have always been to access route variables
though the params scope.

> --
> You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
> To post to this group, send email to cfwh...@googlegroups.com.
> To unsubscribe from this group, send email to cfwheels+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cfwheels?hl=en.
>
>

DustMason

unread,
Nov 10, 2010, 10:10:21 PM11/10/10
to ColdFusion on Wheels
this one got me! i think you should add it to the upgrade
instructions ;)

On Nov 3, 1:05 am, Per Djurner <per.djur...@gmail.com> wrote:
> I don't think this needs to be added to the upgrade instructions since
> the documented approach have always been to access route variables
> though the params scope.
>
>
>
>
>
>
>
> On Tue, Nov 2, 2010 at 8:46 PM, Mike Henke <henkem...@gmail.com> wrote:
> > I like 1.1 RC1 handling of theroutesvariable since the route
> > variable doesn't bleed into the variables scope. I found several
> > places in my code I was using params.RouteVariable and others where I
> > was using RoutesVariable. This "enhancement" helps me be more clear
> > with my code.
>
> > If this behavior is verified with someone else, it should be put into
> > the upgrading doc.http://cfwheels.org/docs/1-1/chapter/upgrading-wheels

Daniel

unread,
Nov 10, 2010, 11:48:29 PM11/10/10
to ColdFusion on Wheels
OK, obviously I was doing this wrong, but Im not sure what I should be
doing differently, my current code:

<cfset addRoute(name="home", pattern="", controller="main",
action="home")>
<cfset addRoute(name="login", pattern="login", controller="sessions",
action="new")>
<cfset addRoute(name="logout", pattern="logout",
controller="sessions", action="delete")>

<cfset addRoute(name="contactus", pattern="contactus",
controller="main", action="contactus")>
<cfset addRoute(name="comingsoon", pattern="comingsoon",
controller="main", action="comingsoon")>
<cfset addRoute(name="upgrades", pattern="upgrades",
controller="main", action="upgrades")>

What do you think? I wrote this awhile ago so Im trying to think about
why I did it this way...

- Daniel

Per Djurner

unread,
Nov 11, 2010, 4:16:49 AM11/11/10
to cfwh...@googlegroups.com
I don't see anything wrong with that.
Looks like you were just trying to shorten your URLs a bit.

Chris Peters

unread,
Nov 11, 2010, 6:01:16 AM11/11/10
to cfwh...@googlegroups.com
Are you asking if that looks like a reasonable configuration, or are you saying that this still isn't working?

It looks good to me. I'm guessing that your strategy here is to group "static" pages in the main controller and use route masking to make them look like their own pages off the root.

Mike Henke

unread,
Nov 11, 2010, 9:14:27 AM11/11/10
to ColdFusion on Wheels
I am with Dustin. It won't hurt but help people if this was added to
the upgrade page.

On Nov 10, 10:10 pm, DustMason <jsit...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages