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:
Ana 2016-08-06 00:57:07 +02:00
parent 96155eb87f
commit 7e5d20c89d
18 changed files with 27 additions and 28 deletions

View file

@ -115,9 +115,7 @@ class Event < ActiveRecord::Base
def submitter
result = event_users.where(event_role: 'submitter').first
if !result.nil?
result.user
else
if result.nil?
user = nil
# Perhaps the event_users haven't been saved, if this is a new proposal
event_users.each do |u|
@ -126,6 +124,8 @@ class Event < ActiveRecord::Base
end
end
user
else
result.user
end
end
@ -281,7 +281,7 @@ class Event < ActiveRecord::Base
def generate_guid
loop do
@guid = SecureRandom.urlsafe_base64
break if !self.class.where(guid: guid).any?
break unless self.class.where(guid: guid).any?
end
self.guid = @guid
end