Remove some calls to `all`. They are not required, and Rails4 raises warnings about them.
This commit is contained in:
parent
112b9f9c2a
commit
0e3b8fbb24
|
@ -16,7 +16,7 @@ class Admin::EmailController < Admin::AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
def logs
|
def logs
|
||||||
@email_logs = EmailLog.limit(50).includes(:user).order('created_at desc').all
|
@email_logs = EmailLog.limit(50).includes(:user).order('created_at desc').to_a
|
||||||
render_serialized(@email_logs, EmailLogSerializer)
|
render_serialized(@email_logs, EmailLogSerializer)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class Admin::GroupsController < Admin::AdminController
|
class Admin::GroupsController < Admin::AdminController
|
||||||
def index
|
def index
|
||||||
groups = Group.order(:name).all
|
groups = Group.order(:name).to_a
|
||||||
render_serialized(groups, BasicGroupSerializer)
|
render_serialized(groups, BasicGroupSerializer)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ class NotificationsController < ApplicationController
|
||||||
before_filter :ensure_logged_in
|
before_filter :ensure_logged_in
|
||||||
|
|
||||||
def index
|
def index
|
||||||
notifications = current_user.notifications.recent.includes(:topic).all.to_a
|
notifications = current_user.notifications.recent.includes(:topic)
|
||||||
|
|
||||||
if notifications.present?
|
if notifications.present?
|
||||||
notifications += current_user.notifications
|
notifications += current_user.notifications
|
||||||
|
@ -11,9 +11,9 @@ class NotificationsController < ApplicationController
|
||||||
.where(read: false, notification_type: Notification.types[:private_message])
|
.where(read: false, notification_type: Notification.types[:private_message])
|
||||||
.where('id < ?', notifications.last.id)
|
.where('id < ?', notifications.last.id)
|
||||||
.limit(5)
|
.limit(5)
|
||||||
.to_a
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
notifications = notifications.to_a
|
||||||
current_user.saw_notification_id(notifications.first.id) if notifications.present?
|
current_user.saw_notification_id(notifications.first.id) if notifications.present?
|
||||||
current_user.reload
|
current_user.reload
|
||||||
current_user.publish_notifications_state
|
current_user.publish_notifications_state
|
||||||
|
|
|
@ -31,7 +31,7 @@ class PostActionsController < ApplicationController
|
||||||
users = User.select(['null as post_url','users.id', 'users.username', 'users.username_lower', 'users.email','post_actions.related_post_id'])
|
users = User.select(['null as post_url','users.id', 'users.username', 'users.username_lower', 'users.email','post_actions.related_post_id'])
|
||||||
.joins(:post_actions)
|
.joins(:post_actions)
|
||||||
.where(['post_actions.post_id = ? and post_actions.post_action_type_id = ? and post_actions.deleted_at IS NULL', @post.id, @post_action_type_id])
|
.where(['post_actions.post_id = ? and post_actions.post_action_type_id = ? and post_actions.deleted_at IS NULL', @post.id, @post_action_type_id])
|
||||||
.all
|
.to_a
|
||||||
|
|
||||||
urls = Post.urls(users.map{|u| u.related_post_id})
|
urls = Post.urls(users.map{|u| u.related_post_id})
|
||||||
users.each do |u|
|
users.each do |u|
|
||||||
|
|
|
@ -140,7 +140,7 @@ class Category < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def publish_categories_list
|
def publish_categories_list
|
||||||
MessageBus.publish('/categories', {categories: ActiveModel::ArraySerializer.new(Category.latest.all).as_json})
|
MessageBus.publish('/categories', {categories: ActiveModel::ArraySerializer.new(Category.latest).as_json})
|
||||||
end
|
end
|
||||||
|
|
||||||
def uncategorized_validator
|
def uncategorized_validator
|
||||||
|
|
|
@ -345,7 +345,7 @@ class PostAction < ActiveRecord::Base
|
||||||
|
|
||||||
# TODO add serializer so we can skip this
|
# TODO add serializer so we can skip this
|
||||||
posts.map!(&:marshal_dump)
|
posts.map!(&:marshal_dump)
|
||||||
[posts, User.select([:id, :username, :email]).where(id: users.to_a).all]
|
[posts, User.select([:id, :username, :email]).where(id: users.to_a).to_a]
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
|
@ -3,7 +3,7 @@ require_dependency 'enum'
|
||||||
class PostActionType < ActiveRecord::Base
|
class PostActionType < ActiveRecord::Base
|
||||||
class << self
|
class << self
|
||||||
def ordered
|
def ordered
|
||||||
order('position asc').all
|
order('position asc')
|
||||||
end
|
end
|
||||||
|
|
||||||
def types
|
def types
|
||||||
|
|
|
@ -253,7 +253,6 @@ class Topic < ActiveRecord::Base
|
||||||
.listable_topics
|
.listable_topics
|
||||||
.limit(SiteSetting.max_similar_results)
|
.limit(SiteSetting.max_similar_results)
|
||||||
.order('similarity desc')
|
.order('similarity desc')
|
||||||
.all
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_status(status, enabled, user)
|
def update_status(status, enabled, user)
|
||||||
|
|
|
@ -223,7 +223,7 @@ describe User do
|
||||||
|
|
||||||
it 'allows moderator to delete all posts' do
|
it 'allows moderator to delete all posts' do
|
||||||
@user.delete_all_posts!(@guardian)
|
@user.delete_all_posts!(@guardian)
|
||||||
expect(Post.where(id: @posts.map(&:id)).all).to be_empty
|
expect(Post.where(id: @posts.map(&:id))).to be_empty
|
||||||
@posts.each do |p|
|
@posts.each do |p|
|
||||||
if p.post_number == 1
|
if p.post_number == 1
|
||||||
expect(Topic.where(id: p.topic_id).first).to be_nil
|
expect(Topic.where(id: p.topic_id).first).to be_nil
|
||||||
|
|
Loading…
Reference in New Issue