application record: drop execute_sql, select_value_sql methods.

This commit is contained in:
evazion
2020-02-16 05:27:51 -06:00
parent 9caa9d8117
commit d3bbd82d8b
8 changed files with 19 additions and 69 deletions

View File

@@ -55,10 +55,10 @@ class Note < ApplicationRecord
def update_post
if self.saved_changes?
if Note.where(:is_active => true, :post_id => post_id).exists?
execute_sql("UPDATE posts SET last_noted_at = ? WHERE id = ?", updated_at, post_id)
if post.notes.active.exists?
post.update_columns(last_noted_at: updated_at)
else
execute_sql("UPDATE posts SET last_noted_at = NULL WHERE id = ?", post_id)
post.update_columns(last_noted_at: nil)
end
end
end