From fd1436b0edc0b04d7c520a888b1cc1037f2cf7e2 Mon Sep 17 00:00:00 2001 From: Parziphal Date: Mon, 12 May 2014 16:33:25 -0500 Subject: [PATCH] Use updateColumns instead. --- app/models/Post.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/models/Post.php b/app/models/Post.php index c905fcb..2b6efea 100755 --- a/app/models/Post.php +++ b/app/models/Post.php @@ -15,8 +15,6 @@ class Post extends Rails\ActiveRecord\Base protected $next_id; - // public $author; - public $updater_user_id; public $updater_ip_addr; @@ -315,10 +313,14 @@ class Post extends Rails\ActiveRecord\Base protected function after_creation() { if ($this->new_tags) { + $this->clearChangedAttributes(); $this->commit_tags(); - $sql = "UPDATE posts SET cached_tags = ? WHERE id = ?"; - self::connection()->executeSql($sql, $this->cached_tags, $this->id); - $this->save(); + + $update = []; + foreach (array_keys($this->changedAttributes()) as $attrName) { + $update[$attrName] = $this->getAttribute($attrName); + } + $this->updateColumns($update); } }