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
$user = User::find(1);
$user->update_attributes(['name' => 'Foo Bar']); //=> updates `updated_at` by calling `touch` internally$user->touch(); //=> updates `updated_at` field to current time$user->touch('deleted_at'); //=> updates `deleted_at` and `updated_at` field to current time
And on associations, to update dependent models:
class User extendsActiveRecord\Model {
}
class Address extendsActiveRecord\Model {
static$belongs_to = [
['user', 'touch' => true]
];
}
$address = Address::find_by_user_id(1);
$address->update_attributes(['zipcode' => '12345']); //=> updates `updated_at`, also for the User
The text was updated successfully, but these errors were encountered:
Just like Rails' AR method
touch
And on associations, to update dependent models:
The text was updated successfully, but these errors were encountered: