Remove autoload trigger
I'm not sure why the code didn't work without this line, but it doesn't seem to be necessary anymore (maybe after upgrading Ruby or Rails?). I'm removing it now because... why not now? :) The Ruby interpreter is raising a warning due to this line, and in Ruby 2.5 constant lookup has changed slightly (although I don't think this line is affected by that change). Note about the change in the Setting model: Ruby actually ignores return values in setter methods, so the line isn't necessary.
This commit is contained in:
@@ -186,6 +186,9 @@ Lint/ShadowingOuterLocalVariable:
|
|||||||
Lint/UselessAssignment:
|
Lint/UselessAssignment:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Lint/Void:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Performance/CompareWithBlock:
|
Performance/CompareWithBlock:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ class PollsController < ApplicationController
|
|||||||
has_filters %w[current expired]
|
has_filters %w[current expired]
|
||||||
has_orders %w[most_voted newest oldest], only: :show
|
has_orders %w[most_voted newest oldest], only: :show
|
||||||
|
|
||||||
::Poll::Answer # trigger autoload
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@polls = Kaminari.paginate_array(
|
@polls = Kaminari.paginate_array(
|
||||||
@polls.created_by_admin.not_budget.send(@current_filter).includes(:geozones).sort_for_list
|
@polls.created_by_admin.not_budget.send(@current_filter).includes(:geozones).sort_for_list
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ class Setting < ApplicationRecord
|
|||||||
setting = find_by(key: key) || new(key: key)
|
setting = find_by(key: key) || new(key: key)
|
||||||
setting.value = value.presence
|
setting.value = value.presence
|
||||||
setting.save!
|
setting.save!
|
||||||
value
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def rename_key(from:, to:)
|
def rename_key(from:, to:)
|
||||||
|
|||||||
Reference in New Issue
Block a user