Add and apply Rails/RedundantActiveRecordAllMethod
This rule was introduced in rubocop-rails 2.21.0.
This commit is contained in:
@@ -437,6 +437,9 @@ Rails/PluralizationGrammar:
|
|||||||
Rails/Presence:
|
Rails/Presence:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Rails/RedundantActiveRecordAllMethod:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Rails/RedundantTravelBack:
|
Rails/RedundantTravelBack:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def load_valuator_groups
|
def load_valuator_groups
|
||||||
@valuator_groups = ValuatorGroup.all.order(name: :asc)
|
@valuator_groups = ValuatorGroup.order(name: :asc)
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_tags
|
def load_tags
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class Admin::GeozonesController < Admin::BaseController
|
|||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@geozones = Geozone.all.order(Arel.sql("LOWER(name)"))
|
@geozones = Geozone.order(Arel.sql("LOWER(name)"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def manage
|
def manage
|
||||||
@booths = ::Poll::Booth.all.order(name: :asc).page(params[:page]).per(300)
|
@booths = ::Poll::Booth.order(name: :asc).page(params[:page]).per(300)
|
||||||
@poll = Poll.find(params[:poll_id])
|
@poll = Poll.find(params[:poll_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def load_geozones
|
def load_geozones
|
||||||
@geozones = Geozone.all.order(:name)
|
@geozones = Geozone.order(:name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def poll_params
|
def poll_params
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class Admin::SignatureSheetsController < Admin::BaseController
|
class Admin::SignatureSheetsController < Admin::BaseController
|
||||||
def index
|
def index
|
||||||
@signature_sheets = SignatureSheet.all.order(created_at: :desc)
|
@signature_sheets = SignatureSheet.order(created_at: :desc)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class Admin::ValuatorGroupsController < Admin::BaseController
|
class Admin::ValuatorGroupsController < Admin::BaseController
|
||||||
def index
|
def index
|
||||||
@groups = ValuatorGroup.all.page(params[:page])
|
@groups = ValuatorGroup.page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ module CommentableActions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def load_geozones
|
def load_geozones
|
||||||
@geozones = Geozone.all.order(name: :asc)
|
@geozones = Geozone.order(name: :asc)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_geozone
|
def set_geozone
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ module GeozonesHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def geozone_select_options
|
def geozone_select_options
|
||||||
Geozone.all.order(name: :asc).map { |g| [g.name, g.id] }
|
Geozone.order(name: :asc).map { |g| [g.name, g.id] }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ module Statisticable
|
|||||||
end
|
end
|
||||||
|
|
||||||
def geozones
|
def geozones
|
||||||
Geozone.all.order("name")
|
Geozone.order("name")
|
||||||
end
|
end
|
||||||
|
|
||||||
def geozone_stats
|
def geozone_stats
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ section "Creating Budgets" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Budget.all.find_each do |budget|
|
Budget.find_each do |budget|
|
||||||
city_group = budget.groups.create!(
|
city_group = budget.groups.create!(
|
||||||
random_locales_attributes(name: -> { I18n.t("seeds.budgets.groups.all_city") })
|
random_locales_attributes(name: -> { I18n.t("seeds.budgets.groups.all_city") })
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ section "Creating Sustainable Development Goals" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
section "Creating SDG homepage cards" do
|
section "Creating SDG homepage cards" do
|
||||||
SDG::Phase.all.find_each do |phase|
|
SDG::Phase.find_each do |phase|
|
||||||
Widget::Card.create!(cardable: phase, title: "#{phase.title} card",
|
Widget::Card.create!(cardable: phase, title: "#{phase.title} card",
|
||||||
link_text: "Link Text", link_url: "/any_path")
|
link_text: "Link Text", link_url: "/any_path")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ describe Shared::BannerComponent do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "does not render anything with no active banners" do
|
it "does not render anything with no active banners" do
|
||||||
Banner.all.find_each { |banner| banner.update!(post_ended_at: Date.current - 1.day) }
|
Banner.find_each { |banner| banner.update!(post_ended_at: Date.current - 1.day) }
|
||||||
|
|
||||||
render_inline Shared::BannerComponent.new("debates")
|
render_inline Shared::BannerComponent.new("debates")
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,6 @@ describe Poll::BoothAssignment do
|
|||||||
|
|
||||||
assignment.destroy!
|
assignment.destroy!
|
||||||
|
|
||||||
expect(Poll::Shift.all.count).to eq(0)
|
expect(Poll::Shift.count).to eq 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ describe Poll::Shift do
|
|||||||
|
|
||||||
expect do
|
expect do
|
||||||
create(:poll_shift, booth: booth, officer: officer, date: Date.current)
|
create(:poll_shift, booth: booth, officer: officer, date: Date.current)
|
||||||
end.to change { Poll::OfficerAssignment.all.count }.by(2)
|
end.to change { Poll::OfficerAssignment.count }.by(2)
|
||||||
|
|
||||||
officer_assignments = Poll::OfficerAssignment.all
|
officer_assignments = Poll::OfficerAssignment.all
|
||||||
oa1 = officer_assignments.first
|
oa1 = officer_assignments.first
|
||||||
@@ -91,7 +91,7 @@ describe Poll::Shift do
|
|||||||
booth_assignment: booth_assignment1,
|
booth_assignment: booth_assignment1,
|
||||||
date: Date.tomorrow)
|
date: Date.tomorrow)
|
||||||
|
|
||||||
expect { Poll::Shift.last.destroy }.to change { Poll::OfficerAssignment.all.count }.by(-2)
|
expect { Poll::Shift.last.destroy }.to change { Poll::OfficerAssignment.count }.by(-2)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "creates final officer_assignments" do
|
it "creates final officer_assignments" do
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ describe ProposalNotification do
|
|||||||
|
|
||||||
it "removes all notifications related to the proposal notification" do
|
it "removes all notifications related to the proposal notification" do
|
||||||
proposal_notification.moderate_system_email(admin.user)
|
proposal_notification.moderate_system_email(admin.user)
|
||||||
expect(Notification.all.count).to be(0)
|
expect(Notification.count).to be 0
|
||||||
end
|
end
|
||||||
|
|
||||||
it "records the moderation action in the Activity table" do
|
it "records the moderation action in the Activity table" do
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ describe "Notifications" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def users_without_notifications
|
def users_without_notifications
|
||||||
User.all.select do |user|
|
User.select do |user|
|
||||||
user.notifications.not_emailed.where(notifiable_type: "ProposalNotification").blank?
|
user.notifications.not_emailed.where(notifiable_type: "ProposalNotification").blank?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user