fixes #2154
This commit is contained in:
@@ -144,10 +144,12 @@ class Note < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_post
|
def update_post
|
||||||
if Note.where(:is_active => true, :post_id => post_id).exists?
|
if self.changed?
|
||||||
execute_sql("UPDATE posts SET last_noted_at = ? WHERE id = ?", updated_at, post_id)
|
if Note.where(:is_active => true, :post_id => post_id).exists?
|
||||||
else
|
execute_sql("UPDATE posts SET last_noted_at = ? WHERE id = ?", updated_at, post_id)
|
||||||
execute_sql("UPDATE posts SET last_noted_at = NULL WHERE id = ?", post_id)
|
else
|
||||||
|
execute_sql("UPDATE posts SET last_noted_at = NULL WHERE id = ?", post_id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user