From 727e7438874559d02a56b9c2785dc5f1d1584867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 20 Nov 2019 01:48:53 +0100 Subject: [PATCH] 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. --- .rubocop.yml | 3 +++ app/controllers/polls_controller.rb | 2 -- app/models/setting.rb | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 14bcb627c..2cf085d92 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -186,6 +186,9 @@ Lint/ShadowingOuterLocalVariable: Lint/UselessAssignment: Enabled: true +Lint/Void: + Enabled: true + Performance/CompareWithBlock: Enabled: true diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 2e4e12045..006d2fe95 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -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 diff --git a/app/models/setting.rb b/app/models/setting.rb index b77b9b797..9e1d9e238 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -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:)