Use updateColumns instead.

This commit is contained in:
Parziphal 2014-05-12 16:33:25 -05:00
parent 177cf1ce0b
commit fd1436b0ed

View File

@ -15,8 +15,6 @@ class Post extends Rails\ActiveRecord\Base
protected $next_id; protected $next_id;
// public $author;
public $updater_user_id; public $updater_user_id;
public $updater_ip_addr; public $updater_ip_addr;
@ -315,10 +313,14 @@ class Post extends Rails\ActiveRecord\Base
protected function after_creation() protected function after_creation()
{ {
if ($this->new_tags) { if ($this->new_tags) {
$this->clearChangedAttributes();
$this->commit_tags(); $this->commit_tags();
$sql = "UPDATE posts SET cached_tags = ? WHERE id = ?";
self::connection()->executeSql($sql, $this->cached_tags, $this->id); $update = [];
$this->save(); foreach (array_keys($this->changedAttributes()) as $attrName) {
$update[$attrName] = $this->getAttribute($attrName);
}
$this->updateColumns($update);
} }
} }