You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(*We are using stable build 1.0)
We are trying to use after_create callback to create other related db entries, but wish if any error in these entries could trigger a rollback. Here is my sample code:
class A extendsActiveRecord\Model{
static$belongs_to = array(
array('b')
);
static$after_create = array(
'update_b'
);
publicfunctionupdate_b() {
$b = $this->b;
if($b->update_attributes(array('foo' => 'bar')))
returntrue;
elsethrownewException("error in updating b");
}
This does not seem to be working. Am I doing something wrong.
Similarly, I haven't been able to auto_save associated models ( has_many relationship)
for example
class C extendsActiveRecord\Model{
static$has_one = array(
array('d')
);
static$before_create = array('build_default_d');
protectedfunctionbuild_default_d() {
$this->build_d();
}
}
This in Ruby's ActiveRecord would have saved associated D as well on saving A, doesn't seem to be working here.
The text was updated successfully, but these errors were encountered:
(*We are using stable build 1.0)
We are trying to use after_create callback to create other related db entries, but wish if any error in these entries could trigger a rollback. Here is my sample code:
This does not seem to be working. Am I doing something wrong.
Similarly, I haven't been able to auto_save associated models ( has_many relationship)
for example
This in Ruby's ActiveRecord would have saved associated D as well on saving A, doesn't seem to be working here.
The text was updated successfully, but these errors were encountered: