Add and apply Rails/OrderArguments rubocop rule
This rule was introduced in rubocop-rails 2.33. We were following it most of the time.
This commit is contained in:
@@ -469,6 +469,9 @@ Rails/NotNullColumn:
|
||||
Exclude:
|
||||
- "db/migrate/201[5-7]*"
|
||||
|
||||
Rails/OrderArguments:
|
||||
Enabled: true
|
||||
|
||||
Rails/OutputSafety:
|
||||
Enabled: true
|
||||
Severity: warning
|
||||
|
||||
@@ -35,11 +35,11 @@ class Admin::BudgetInvestments::SearchFormComponent < ApplicationComponent
|
||||
end
|
||||
|
||||
def valuator_group_select_options
|
||||
ValuatorGroup.order("name ASC").map { |g| [g.name, "group_#{g.id}"] }
|
||||
ValuatorGroup.order(:name).map { |g| [g.name, "group_#{g.id}"] }
|
||||
end
|
||||
|
||||
def valuator_select_options
|
||||
budget.valuators.order("description ASC").order("users.email ASC").includes(:user)
|
||||
budget.valuators.order(:description).order("users.email ASC").includes(:user)
|
||||
.map { |v| [v.description_or_email, "valuator_#{v.id}"] }
|
||||
end
|
||||
|
||||
|
||||
@@ -21,6 +21,6 @@ class Admin::HomepageController < Admin::BaseController
|
||||
end
|
||||
|
||||
def load_feeds
|
||||
@feeds = Widget::Feed.order("created_at")
|
||||
@feeds = Widget::Feed.order(:created_at)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ class Admin::SiteCustomization::PagesController < Admin::SiteCustomization::Base
|
||||
load_and_authorize_resource :page, class: "SiteCustomization::Page"
|
||||
|
||||
def index
|
||||
@pages = SiteCustomization::Page.order("slug").page(params[:page])
|
||||
@pages = SiteCustomization::Page.order(:slug).page(params[:page])
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@@ -69,8 +69,8 @@ class Budget
|
||||
scope :sort_by_confidence_score, -> { reorder(confidence_score: :desc, id: :desc) }
|
||||
scope :sort_by_ballots, -> { reorder(ballot_lines_count: :desc, id: :desc) }
|
||||
scope :sort_by_price, -> { reorder(price: :desc, confidence_score: :desc, id: :desc) }
|
||||
scope :sort_by_id, -> { order("id DESC") }
|
||||
scope :sort_by_supports, -> { order("cached_votes_up DESC") }
|
||||
scope :sort_by_id, -> { order(id: :desc) }
|
||||
scope :sort_by_supports, -> { order(cached_votes_up: :desc) }
|
||||
|
||||
scope :valuation_open, -> { where(valuation_finished: false) }
|
||||
scope :with_admin, -> { where.not(administrator_id: nil) }
|
||||
|
||||
@@ -75,7 +75,7 @@ class Budget::Stats
|
||||
|
||||
def headings
|
||||
groups = Hash.new(0)
|
||||
budget.headings.order("id ASC").each do |heading|
|
||||
budget.headings.order(:id).each do |heading|
|
||||
groups[heading.id] = Hash.new(0).merge(calculate_heading_totals(heading))
|
||||
end
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ module Statisticable
|
||||
end
|
||||
|
||||
def geozones
|
||||
Geozone.order("name")
|
||||
Geozone.order(:name)
|
||||
end
|
||||
|
||||
def range_description(start, finish)
|
||||
|
||||
@@ -19,7 +19,7 @@ class Legislation::DraftVersion < ApplicationRecord
|
||||
validates_translation :body, presence: true
|
||||
validates :status, presence: true, inclusion: { in: ->(*) { VALID_STATUSES }}
|
||||
|
||||
scope :published, -> { where(status: "published").order("id DESC") }
|
||||
scope :published, -> { where(status: "published").order(id: :desc) }
|
||||
|
||||
def body_html
|
||||
MarkdownConverter.new(body, with_toc_data: true).render
|
||||
|
||||
@@ -27,7 +27,7 @@ class Legislation::Question < ApplicationRecord
|
||||
validates :process, presence: true
|
||||
validates_translation :title, presence: true
|
||||
|
||||
scope :sorted, -> { order("id ASC") }
|
||||
scope :sorted, -> { order(:id) }
|
||||
|
||||
def next_question_id
|
||||
@next_question_id ||= process.questions.where("id > ?", id).sorted.limit(1).ids.first
|
||||
|
||||
@@ -12,7 +12,7 @@ class Poll::Question < ApplicationRecord
|
||||
|
||||
has_many :comments, as: :commentable, inverse_of: :commentable
|
||||
has_many :answers, class_name: "Poll::Answer"
|
||||
has_many :question_options, -> { order "given_order asc" },
|
||||
has_many :question_options, -> { order :given_order },
|
||||
class_name: "Poll::Question::Option",
|
||||
inverse_of: :question,
|
||||
dependent: :destroy
|
||||
|
||||
@@ -13,8 +13,8 @@ class SiteCustomization::Page < ApplicationRecord
|
||||
validates :status, presence: true, inclusion: { in: ->(*) { VALID_STATUSES }}
|
||||
|
||||
scope :published, -> { where(status: "published").sort_desc }
|
||||
scope :sort_asc, -> { order("id ASC") }
|
||||
scope :sort_desc, -> { order("id DESC") }
|
||||
scope :sort_asc, -> { order(:id) }
|
||||
scope :sort_desc, -> { order(id: :desc) }
|
||||
scope :with_more_info_flag, -> { where(status: "published", more_info_flag: true).sort_asc }
|
||||
scope :with_same_locale, -> { joins(:translations).locale }
|
||||
scope :locale, -> { where("site_customization_page_translations.locale": I18n.locale) }
|
||||
|
||||
@@ -29,6 +29,6 @@ class Widget::Feed < ApplicationRecord
|
||||
end
|
||||
|
||||
def processes
|
||||
Legislation::Process.open.published.order("created_at DESC").limit(limit)
|
||||
Legislation::Process.open.published.order(created_at: :desc).limit(limit)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user