Hi folks,

I have this problem:

When I save through the model like this:

$this->CurrencyRate->save($rate); (in the CurrencyRates controller)

I get this resulting SQL statement:

INSERT INTO `currency_rates` (`currency_id`, `rate`, `created`) VALUES
(10, 1.15, 'here goes the current timestamp and it's OK).

But when I try to save it through the associated model like this:

$this->Currency->CurrencyRate->save($rate); (in the Currencies
controller)

I get this resulting SQL statement:

INSERT INTO `currency_rates` (`created`, `currency_id`, `rate`) VALUES
('CURRENT_TIMESTAMP', 10, 1.15)

and the timestamp is set to zeroes in the database.

In both cases I do not set the 'created' field, it should be the
current timestamp and in the first case it works fine, but as you can
see, in the second case the value is wrong.

The model associations are OK - with $hasMany('CurrencyRate') in the
Currency model and $belongesTo('Currency') in the CurrencyRate model.

I can't figure out where the problem is. One solution is to set the
'created' field before saving the data and it works, but I am sure
there is an explanation for the above.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to