Skip to content

Commit 188a706

Browse files
authored
Merge pull request #1514 from cfwheels/architecture-3.0
docs update and wheels error update
2 parents 479e85f + 4196f30 commit 188a706

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

guides/handling-requests-with-controllers/using-filters.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Sure, that works. But you're already starting to repeat yourself in the code. Wh
3838
component extends="Controller" {
3939

4040
function secretStuff() {
41-
if ( cgi.remote_addr Does !Contain "212.55" ) {
41+
if ( !find("212.55", cgi.remote_addr) ) {
4242
flashInsert(alert="Sorry, we're !open in that area.");
4343
redirectTo(action="sorry");
4444
} else if ( !StructKeyExists(session, "userId") ) {
@@ -48,7 +48,7 @@ component extends="Controller" {
4848
}
4949

5050
function evenMoreSecretStuff() {
51-
if ( cgi.remote_addr Does !Contain "212.55" ) {
51+
if ( !find("212.55", cgi.remote_addr) ) {
5252
flashInsert(msg="Sorry, we're !open in that area.");
5353
redirectTo(action="sorry");
5454
} else if ( !StructKeyExists(session, "userId") ) {
@@ -76,7 +76,7 @@ component extends="Controller" {
7676
}
7777

7878
function restrictAccess() {
79-
if ( cgi.remote_addr Does !Contain "212.55" ) {
79+
if ( !find("212.55", cgi.remote_addr) ) {
8080
flashInsert(msg="Sorry, we're !open in that area.");
8181
redirectTo(action="sorry");
8282
} else if ( !StructKeyExists(session, "userId") ) {
@@ -98,7 +98,7 @@ component extends="Controller" {
9898
}
9999

100100
private function restrictAccess() {
101-
if ( cgi.remote_addr Does !Contain "212.55" ) {
101+
if ( !find("212.55", cgi.remote_addr) ) {
102102
flashInsert(msg="Sorry, we're !open in that area.");
103103
redirectTo(action="sorry");
104104
} else if ( !StructKeyExists(session, "userId") ) {
@@ -177,7 +177,7 @@ Now the `byIP` argument will be available in the `authorize` function.
177177
To help you avoid any clashing of argument names, CFWheels also supports passing in the arguments in a struct as well:
178178

179179
```javascript
180-
// The `through` argument would clash here if it wasn't stored within a struct
180+
// The `through` argument would clash here if it wasn't stored within a struct
181181
args.byIP = true;
182182
args.through = true;
183183
filters(through="authorize", authorizeArguments=args);
@@ -190,14 +190,14 @@ Because your controller's `config()` function only runs once per application sta
190190
For example, this code would only evaluate the value for `request.region` on the very first request, and CFWheels will store that particular value in memory for all subsequent requests:
191191

192192
```javascript
193-
// This is probably not what you intended
193+
// This is probably not what you intended
194194
filters(through="authorize", byIP=true, region=request.region);
195195
```
196196

197197
To avoid this hard-coding of values from request to request, you can instead pass an expression. (The double pound signs are necessary to escape dynamic values within the string. We only want to store a string representation of the expression to be evaluated.)
198198

199199
```javascript
200-
// This is probably more along the lines of what you intended
200+
// This is probably more along the lines of what you intended
201201
filters(through="authorize", byIP=true, region="##request.region##");
202202
```
203203

vendor/wheels/Global.cfc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ component output="false" {
189189
try{
190190
cfdbinfo(attributeCollection="#arguments#");
191191
}catch(any e){
192+
cfdbinfo(attributeCollection="#arguments#");
192193
local.type = arguments.type;
193194
arguments.type = "dbnames";
194195
cfdbinfo(attributeCollection="#arguments#");

0 commit comments

Comments
 (0)