Problem with hasOne Relation
Hi there,
I'm new to Cake and now I seem to have a little understanding problem.
The situation is this:
I have a UsersController and a User Model. Then there is an
editProfile() method within my UsersController. Of course I also
created a view (users/edit_profile.ctp). My problem is that I want to
have an editable automagic form on that page that is linked to the
user_profiles table.
What I did is, I added "var $hasOne = array('UserProfile');" to my
User Model. And I created a form like this:
echo $form->create('UserProfile');
echo $form->input('id');
echo $form->input('name');
echo $form->end();
Then I created a user_profile.php model file and added "var $belongsTo
= 'User';" to it. The user_profiles table has a "user_id" foreign key.
When I send the form, cake throws an error as it cannot find the
"UserProfileController". Normally this would be ok but for I want the
UsersController to do all the work it's not. What can I do? I mean, I
could create a user_profiles_controller.php to send the form and
afterwards do a redirect to the form but that wouldn't be very
fashionable.
I hope you can help me out.
Regards
Raphi
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home