Skip to content

Commit 7823e1e

Browse files
committed
Unify redirect_to targets
1 parent 2e0ec41 commit 7823e1e

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

app/controllers/collections_controller.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ def create
4141
# Redirect back to task#show as collections with tasks can only be created from that view
4242
create_collection_with_task
4343
elsif @collection.save
44-
redirect_to collections_path, notice: t('common.notices.object_created', model: Collection.model_name.human)
44+
redirect_to Collection, notice: t('common.notices.object_created', model: Collection.model_name.human)
4545
else
4646
render :new
4747
end
4848
end
4949

5050
def update
5151
if @collection.update(collection_params)
52-
redirect_to collections_path, notice: t('common.notices.object_updated', model: Collection.model_name.human)
52+
redirect_to Collection, notice: t('common.notices.object_updated', model: Collection.model_name.human)
5353
else
5454
render :edit
5555
end
@@ -94,9 +94,9 @@ def download_all
9494

9595
def share
9696
if share_message.save
97-
redirect_to collection_path(@collection), notice: t('.success_notice')
97+
redirect_to @collection, notice: t('.success_notice')
9898
else
99-
redirect_to collection_path(@collection), alert: share_message.errors.full_messages.join(', ')
99+
redirect_to @collection, alert: share_message.errors.full_messages.join(', ')
100100
end
101101
end
102102

@@ -119,10 +119,10 @@ def save_shared # rubocop:disable Metrics/AbcSize
119119
def leave
120120
if @collection.users.count == 1
121121
@collection.destroy
122-
redirect_to collections_path, notice: t('common.notices.object_deleted', model: Collection.model_name.human)
122+
redirect_to Collection, notice: t('common.notices.object_deleted', model: Collection.model_name.human)
123123
else
124124
@collection.users.delete(current_user)
125-
redirect_to collections_path, notice: t('.left_successfully')
125+
redirect_to Collection, notice: t('.left_successfully')
126126
end
127127
end
128128

app/controllers/groups_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ def update
4646

4747
def destroy
4848
@group.destroy
49-
redirect_to groups_url, notice: t('common.notices.object_deleted', model: Group.model_name.human)
49+
redirect_to Group, notice: t('common.notices.object_deleted', model: Group.model_name.human)
5050
end
5151

5252
def leave
5353
if @group.last_admin?(current_user)
5454
redirect_to @group, alert: t('.cannot_leave_alert')
5555
else
5656
@group.users.delete(current_user)
57-
redirect_to groups_path, notice: t('.success_notice')
57+
redirect_to Group, notice: t('.success_notice')
5858
end
5959
end
6060

@@ -66,7 +66,7 @@ def request_access
6666
AccessRequestMailer.send_access_request(current_user, admin, @group).deliver_later
6767
end
6868
@group.add(current_user, role: :applicant)
69-
redirect_to groups_path
69+
redirect_to Group
7070
end
7171

7272
def remove_task

app/controllers/tasks_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def update
7575

7676
def destroy
7777
@task.destroy!
78-
redirect_to tasks_url, notice: t('common.notices.object_deleted', model: Task.model_name.human)
78+
redirect_to Task, notice: t('common.notices.object_deleted', model: Task.model_name.human)
7979
end
8080

8181
def add_to_collection

app/controllers/users_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class UsersController < ApplicationController
77
if current_user
88
redirect_to({id: current_user.id}, alert: t('common.errors.not_authorized'))
99
else
10-
redirect_to root_path, alert: t('common.errors.not_authorized')
10+
redirect_to :root, alert: t('common.errors.not_authorized')
1111
end
1212
end
1313

0 commit comments

Comments
 (0)