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:
Javi Martín
2019-11-20 01:48:53 +01:00
parent 4ba4289006
commit 727e743887
3 changed files with 3 additions and 3 deletions

View File

@@ -186,6 +186,9 @@ Lint/ShadowingOuterLocalVariable:
Lint/UselessAssignment:
Enabled: true
Lint/Void:
Enabled: true
Performance/CompareWithBlock:
Enabled: true

View File

@@ -9,8 +9,6 @@ class PollsController < ApplicationController
has_filters %w[current expired]
has_orders %w[most_voted newest oldest], only: :show
::Poll::Answer # trigger autoload
def index
@polls = Kaminari.paginate_array(
@polls.created_by_admin.not_budget.send(@current_filter).includes(:geozones).sort_for_list

View File

@@ -38,7 +38,6 @@ class Setting < ApplicationRecord
setting = find_by(key: key) || new(key: key)
setting.value = value.presence
setting.save!
value
end
def rename_key(from:, to:)