Have you added 'Session' to the $components var? For the controller, and to the 
$helpers for use in you views?

On Aug 27, 2010, at 3:02 AM, Tryc <trycad...@gmail.com> wrote:

> can you show me the finished code?
> 
> user_component.php ?
> 
> why not users_controller.php?
> 
> On 8月27日, 上午7时11分, Chuck <chivalrys...@gmail.com> wrote:
>> When I have the Auth component on (component added to
>> app_controller.php, login(), logout() and beforeFilter() methods added
>> to user_component.php) and I attempt to add a user, the record gets
>> added, but I get the following error:
>> 
>> Notice (8): Undefined property: UsersController::$Session [APP/
>> controllers/users_controller.php, line 60]
>> Fatal error: Call to a member function setFlash() on a non-object in /
>> home/mydomain/dev. mydomain.com/app/controllers/users_controller.php
>> on line 60
>> 
>> For the most part, this is a plain baked site. Line 60 is in the add
>> action of users_controller.php, the line that reads 
>> $this->Session->setFlash( __( 'The user has been saved', true ) );. The 
>> entire add
>> 
>> action is below, which I believe is simply the action created by bake.
>> 
>> function add() {
>>        if ( !empty( $this->data ) ) {
>>                $this->User->create();
>>                if ( $this->User->save( $this->data ) ) {
>>                        $this->Session->setFlash( __( 'The user has been 
>> saved', true ) );
>>                        $this->redirect( array( 'action' => 'index' ) );
>>                } else {
>>                        $this->Session->setFlash( __( 'The user could not be 
>> saved. Please,
>> try again.', true ) );
>>                }
>>        }
>>        $userTypes = $this->User->UserType->find( 'list' );
>>        $this->set( compact( 'userTypes' ) );
>> 
>> }
>> 
>> I only get the error when Auth is enabled. Any suggestions on how to
>> fix this would be appreciated.
>> 
>> Thanks,
>> Chuck
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to