Changeset 292

Show
Ignore:
Timestamp:
08/07/07 09:44:45 (5 years ago)
Author:
john
Message:

fixed AC id wasn't being set on custom routes

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/trax/vendor/trax/action_controller.php

    r284 r292  
    499499                } 
    500500                //error_log('action='.$this->action); 
     501 
    501502                //  FIXME: RoR uses :name as a keyword parameter, id 
    502503                //  is not treated as a special case. 
    503504                //  Do we want to do the same? 
    504                 if(@in_array(":id",$route_path) 
     505                if(is_array($route_params) 
     506                   && array_key_exists(":id",$route_params)) { 
     507 
     508                    //  ':id' in route params overrides URL 
     509                    $this->id = $route_params[':id']; 
     510                } elseif(@in_array(":id",$route_path) 
    505511                   && array_key_exists(@array_search(":id", $route_path), 
    506512                                       $this->url_path)) { 
     
    511517                        $this->action_params['id'] = $this->id; 
    512518                    } 
    513                     //  For historical reasons, continue to pass id 
    514                     //  in $_REQUEST 
    515                     if($this->id != "") { 
    516                         $_REQUEST['id'] = $this->id; 
    517                     } 
    518519                } 
     520                //  For historical reasons, continue to pass id 
     521                //  in $_REQUEST 
     522                if($this->id != "") { 
     523                    $_REQUEST['id'] = $this->id; 
     524                } 
     525                //error_log('id='.$this->id); 
     526 
    519527                $this->views_path .= "/" . $this->controller; 
    520528                $this->controller_file = $this->controllers_path . "/" .  $this->controller . "_controller.php";