Using guard clause instead of conditional wrapping
Signed-off-by: Carlos Coelho <carlos@pencillabs.com>
This commit is contained in:
parent
2302821c48
commit
aa912357d6
1 changed files with 3 additions and 5 deletions
|
|
@ -148,11 +148,9 @@ class ProposalController < ApplicationController
|
||||||
@event.event_users.new(user: current_user,
|
@event.event_users.new(user: current_user,
|
||||||
event_role: 'speaker')
|
event_role: 'speaker')
|
||||||
|
|
||||||
unless @event.save
|
return unless !@event.save
|
||||||
flash[:error] = "Could not submit proposal: #{@event.errors.full_messages.join(', ')}"
|
flash[:error] = "Could not submit proposal: #{@event.errors.full_messages.join(', ')}"
|
||||||
render action: 'new'
|
render action: 'new'
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue