style: if ! changed by unless
- if ! changed by unless as it is more readable - !object.blank? is equivalent to object.present?, also more readable
This commit is contained in:
parent
96155eb87f
commit
7e5d20c89d
18 changed files with 27 additions and 28 deletions
|
|
@ -103,7 +103,7 @@ module Admin
|
|||
comment.commentable = @event
|
||||
comment.user_id = current_user.id
|
||||
comment.save!
|
||||
if !params[:parent].nil?
|
||||
unless params[:parent].nil?
|
||||
comment.move_to_child_of(params[:parent])
|
||||
end
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ module Admin
|
|||
|
||||
def get_event
|
||||
@event = @conference.program.events.find(params[:id])
|
||||
if !@event
|
||||
unless @event
|
||||
redirect_to admin_conference_program_events_path(conference_id: @conference.short_title),
|
||||
error: 'Error! Could not find event!'
|
||||
return
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ module Admin
|
|||
def destroy
|
||||
if can? :destroy, @question
|
||||
# Do not delete global questions
|
||||
if !@question.global
|
||||
unless @question.global
|
||||
|
||||
# Delete question and its answers
|
||||
begin
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class ApplicationController < ActionController::Base
|
|||
rescue_from CanCan::AccessDenied do |exception|
|
||||
Rails.logger.debug "Access denied on #{exception.action} #{exception.subject.inspect}"
|
||||
message = exception.message
|
||||
message << ' Maybe you need to sign in?' if !current_user
|
||||
message << ' Maybe you need to sign in?' unless current_user
|
||||
redirect_to root_path, alert: message
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class ConferenceRegistrationsController < ApplicationController
|
|||
ahoy.track 'Registered', title: 'New registration'
|
||||
|
||||
# Sign in the new user
|
||||
if !current_user
|
||||
unless current_user
|
||||
sign_in(@registration.user)
|
||||
end
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ class ConferenceRegistrationsController < ApplicationController
|
|||
|
||||
def set_registration
|
||||
@registration = Registration.find_by(conference: @conference, user: current_user)
|
||||
if !@registration
|
||||
unless @registration
|
||||
redirect_to new_conference_conference_registration_path(@conference.short_title),
|
||||
error: "Can't find a registration for #{@conference.title} for you. Please register."
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue