Your problem lies in this part:
[Rate] => Array
(
[s1_title] => title 1
[s1_day] => day 1
[s1_week] =>
[s1_month] =>
[extra_info] =>
)
I assume that this information was at first retrieved from the
database and presented to the user. The user then changed something
and saved.
The above information lacks the Rate.id information - without which
CakePHP assumes that you are saving a new record in the Rate model.
You have to add the Rate.id as a hidden field in the view (worst
solution) or get it from somewhere else.
Hope this will help you on the way,
John
On Feb 10, 8:09 pm, koala kid <[email protected]> wrote:
> Hi, I'm still struggling with saving information to related tables. I
> have a form which updates info about a rental property and I have an
> associated Rates table which holds data about the rental rates for the
> property.
>
> I've defined my relationship as :
>
> Rental -> hasOne
> Rate -> belongsTo
>
> My save action looks like this:
>
> $this->Rental->saveAll($this->data);
>
> However this save action is creating a new entry in the Rates table
> rather than updating the existing one. I'm pretty sure my form data is
> in the correct format:
>
> Array
> (
> [Rental] => Array
> (
> [id] => 45
> [rental_code] => PDSSerena
> [location_id] => 19
> [rental_agent] =>
> [rental_meta_url] =>
> [rental_meta_title] =>
> [rental_meta_desc] =>
> [rental_meta_tags] =>
> )
>
> [Rate] => Array
> (
> [s1_title] => title 1
> [s1_day] => day 1
> [s1_week] =>
> [s1_month] =>
> [extra_info] =>
> )
>
> )
>
> Do I need to explicitly set the rental_id in my Rate form data, such
> as:
>
> [Rate] => Array
> (
> [rental_id] => 45
> )
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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en