Fix Rubocop issues

This commit is contained in:
CactusPuppy 2021-02-18 21:03:28 -08:00
parent a45008640f
commit 7f5d06b23c
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82
27 changed files with 94 additions and 83 deletions

View file

@ -9,7 +9,7 @@ module Admin
def index
@events = Event.accessible_by(current_ability).where(program: @program,
state: [:confirmed, :unconfirmed])
state: [:confirmed, :unconfirmed])
@events_commercials = Commercial.where(commercialable_type: 'Event', commercialable_id: @events.pluck(:id))
@events_missing_commercial = @events.where.not(id: @events_commercials.pluck(:commercialable_id))
@events_with_requirements = @events.where.not(description: ['', nil])

View file

@ -10,22 +10,22 @@ class ApplicationController < ActionController::Base
check_authorization unless: :devise_controller?
skip_authorization_check if:
def store_location
# store last url - this is needed for post-login redirect to whatever the user last visited.
return unless request.get?
def store_location
# store last url - this is needed for post-login redirect to whatever the user last visited.
return unless request.get?
if (request.path != '/accounts/sign_in' &&
request.path != '/accounts/sign_up' &&
request.path != '/accounts/password/new' &&
request.path != '/accounts/password/edit' &&
request.path != '/accounts/confirmation' &&
request.path != '/accounts/sign_out' &&
request.path != '/users/ichain_registration/ichain_sign_up' &&
!request.path.starts_with?(Devise.ichain_base_url) &&
!request.xhr?) # don't store ajax calls
session[:return_to] = request.fullpath
end
end
if (request.path != '/accounts/sign_in' &&
request.path != '/accounts/sign_up' &&
request.path != '/accounts/password/new' &&
request.path != '/accounts/password/edit' &&
request.path != '/accounts/confirmation' &&
request.path != '/accounts/sign_out' &&
request.path != '/users/ichain_registration/ichain_sign_up' &&
!request.path.starts_with?(Devise.ichain_base_url) &&
!request.xhr?) # don't store ajax calls
session[:return_to] = request.fullpath
end
end
def after_sign_in_path_for(_resource)
if (can? :view, Conference) &&

View file

@ -27,11 +27,13 @@ class UsersController < ApplicationController
def user_params
params.require(:user).permit(:name, :biography, :nickname, :affiliation,
:picture, :picture_cache)
:picture, :picture_cache)
end
# Somewhat of a hack: users/current/edit
# rubocop:disable Naming/MemoizedInstanceVariableName
def load_user
@user ||= (params[:id] && params[:id] != 'current' && User.find(params[:id]) || current_user)
end
# rubocop:enable Naming/MemoizedInstanceVariableName
end