mirror of
https://github.com/discourse/discourse.git
synced 2025-04-08 17:24:27 +08:00
rails 4 deprecation fixes
This commit is contained in:
parent
6fac09aeaa
commit
ff957a7b37
@ -14,7 +14,7 @@ class ActiveRecord::Base
|
|||||||
# note: update_attributes still spins up a transaction this can cause contention
|
# note: update_attributes still spins up a transaction this can cause contention
|
||||||
# this method performs the raw update sidestepping the locking
|
# this method performs the raw update sidestepping the locking
|
||||||
def update_columns(hash)
|
def update_columns(hash)
|
||||||
self.class.update_all(hash, self.class.primary_key => self.id)
|
self.class.where(self.class.primary_key => self.id).update_all(hash)
|
||||||
end
|
end
|
||||||
|
|
||||||
def exec_sql(*args)
|
def exec_sql(*args)
|
||||||
|
@ -112,9 +112,9 @@ class PostCreator
|
|||||||
|
|
||||||
def track_latest_on_category
|
def track_latest_on_category
|
||||||
if @post && @post.errors.count == 0 && @topic && @topic.category_id
|
if @post && @post.errors.count == 0 && @topic && @topic.category_id
|
||||||
Category.update_all( {latest_post_id: @post.id}, {id: @topic.category_id} )
|
Category.where(id: @topic.category_id).update_all(latest_post_id: @post.id)
|
||||||
if @post.post_number == 1
|
if @post.post_number == 1
|
||||||
Category.update_all( {latest_topic_id: @topic.id}, {id: @topic.category_id} )
|
Category.where(id: @topic.category_id).update_all(latest_topic_id: @topic.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -70,10 +70,8 @@ module DiscourseTask
|
|||||||
topic.update_meta_data(complete: false)
|
topic.update_meta_data(complete: false)
|
||||||
topic.add_moderator_post(current_user, I18n.t(:'task.reversed'))
|
topic.add_moderator_post(current_user, I18n.t(:'task.reversed'))
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
render nothing: true
|
render nothing: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user