Skip to content

Commit

Permalink
Replace hard coded controller paths with variables
Browse files Browse the repository at this point in the history
  • Loading branch information
hantuzun committed Apr 19, 2020
1 parent 4d6fa3a commit 49c8ff8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/controllers/api/hospitals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ def create
hospital = create_hospital(hospital_name, country, state, city)
rescue => e
flash.alert = '<i class="fas fa-exclamation-triangle mr-1"></i> ' + t("hospitals.index.form.messages.error")
redirect_to '/hospitals' and return
redirect_to hospitals_path and return
end

begin
create_hospital_staff(contact_name, contact_email, hospital.id)
rescue => e
flash.alert = '<i class="fas fa-exclamation-triangle mr-1"></i> ' + t("hospitals.index.form.messages.error")
redirect_to '/hospitals' and return
redirect_to hospitals_path and return
end

flash.notice = '<i class="fas fa-heart mr-1"></i> ' + t("hospitals.index.form.messages.success")
redirect_to '/' and return
redirect_to root_path and return
end

def create_hospital(hospital_name, country, state, city)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/partners_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def create

if partner.save
flash.notice = '<i class="fas fa-heart mr-1"></i> ' + t("partners.index.form.messages.success")
redirect_to '/'
redirect_to root_path
else
flash.now.alert = '<i class="fas fa-exclamation-triangle mr-1"></i> ' + t("partners.index.form.messages.error")

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/volunteers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def create
if @volunteer.save
VolunteerNotifierMailer.send_registration_email(@volunteer).deliver_later
flash.notice = '<i class="fas fa-heart mr-1"></i> ' + t("volunteers.form.messages.success")
redirect_to '/' and return
redirect_to root_path and return
else
flash.now.alert = '<i class="fas fa-exclamation-triangle mr-1"></i> ' + t("volunteers.form.messages.error")
render :template => 'home/index' and return
Expand Down

0 comments on commit 49c8ff8

Please sign in to comment.