Use _path consistently in the controllers when not changing host

This commit is contained in:
David Heinemeier Hansson
2024-10-19 19:00:04 -07:00
parent 6c5db3826b
commit b7efd04a43
12 changed files with 21 additions and 21 deletions
@@ -12,7 +12,7 @@ class Accounts::JoinCodesController < ApplicationController
private
def qr_code_svg
join_url(Current.account.join_code).then do |url|
join_path(Current.account.join_code).then do |url|
RQRCode::QRCode.new(url).as_svg(viewbox: true, fill: :white, color: :black)
end
end
+1 -1
View File
@@ -8,7 +8,7 @@ class Accounts::UsersController < ApplicationController
def destroy
@user.deactivate
redirect_to users_url
redirect_to users_path
end
private
+1 -1
View File
@@ -3,7 +3,7 @@ class AssignmentsController < ApplicationController
def create
@bubble.assign(find_assignee)
redirect_to bucket_bubble_url(@bucket, @bubble)
redirect_to bucket_bubble_path(@bucket, @bubble)
end
private
+1 -1
View File
@@ -3,6 +3,6 @@ class Bubbles::ImagesController < ApplicationController
def destroy
@bubble.image.purge_later
redirect_to bucket_bubble_url(@bubble.bucket, @bubble)
redirect_to bucket_bubble_path(@bubble.bucket, @bubble)
end
end
+2 -2
View File
@@ -3,11 +3,11 @@ class Bubbles::PopsController < ApplicationController
def create
@bubble.pop!
redirect_to bucket_bubble_url(@bubble.bucket, @bubble)
redirect_to bucket_bubble_path(@bubble.bucket, @bubble)
end
def destroy
@bubble.unpop
redirect_to bucket_bubble_url(@bubble.bucket, @bubble)
redirect_to bucket_bubble_path(@bubble.bucket, @bubble)
end
end
+2 -2
View File
@@ -15,7 +15,7 @@ class BubblesController < ApplicationController
def create
@bubble = @bucket.bubbles.create!
redirect_to bucket_bubble_url(@bucket, @bubble)
redirect_to bucket_bubble_path(@bucket, @bubble)
end
def show
@@ -27,7 +27,7 @@ class BubblesController < ApplicationController
def update
@bubble.update! bubble_params
redirect_to bucket_bubble_url(@bucket, @bubble)
redirect_to bucket_bubble_path(@bucket, @bubble)
end
private
+3 -3
View File
@@ -11,7 +11,7 @@ class BucketsController < ApplicationController
def create
@bucket = Current.account.buckets.create! bucket_params
redirect_to bucket_bubbles_url(@bucket)
redirect_to bucket_bubbles_path(@bucket)
end
def edit
@@ -25,12 +25,12 @@ class BucketsController < ApplicationController
@bucket.accesses.revise granted: grantees, revoked: revokees
end
redirect_to bucket_bubbles_url(@bucket)
redirect_to bucket_bubbles_path(@bucket)
end
def destroy
@bucket.destroy
redirect_to buckets_url
redirect_to buckets_path
end
private
+1 -1
View File
@@ -3,6 +3,6 @@ class CommentsController < ApplicationController
def create
@bubble.comment! params.expect(comment: [ :body ])
redirect_to bucket_bubble_url(@bucket, @bubble)
redirect_to bucket_bubble_path(@bucket, @bubble)
end
end
+2 -2
View File
@@ -9,12 +9,12 @@ class FirstRunsController < ApplicationController
def create
user = FirstRun.create!(user_params)
start_new_session_for user
redirect_to root_url
redirect_to root_path
end
private
def prevent_repeats
redirect_to root_url unless Account.none?
redirect_to root_path unless Account.none?
end
def user_params
+5 -5
View File
@@ -1,6 +1,6 @@
class SessionsController < ApplicationController
allow_unauthenticated_access only: %i[ new create ]
rate_limit to: 10, within: 3.minutes, only: :create, with: -> { redirect_to new_session_url, alert: "Try again later." }
rate_limit to: 10, within: 3.minutes, only: :create, with: -> { redirect_to new_session_path, alert: "Try again later." }
before_action :require_first_run_completion
@@ -10,19 +10,19 @@ class SessionsController < ApplicationController
def create
if user = User.active.authenticate_by(params.permit(:email_address, :password))
start_new_session_for user
redirect_to after_authentication_url
redirect_to after_authentication_path
else
redirect_to new_session_url, alert: "Try another email address or password."
redirect_to new_session_path, alert: "Try another email address or password."
end
end
def destroy
terminate_session
redirect_to new_session_url
redirect_to new_session_path
end
private
def require_first_run_completion
redirect_to first_run_url if Account.none?
redirect_to first_run_path if Account.none?
end
end
+1 -1
View File
@@ -13,7 +13,7 @@ class TagsController < ApplicationController
def create
@bubble.tags << Current.account.tags.find_or_create_by!(tag_params)
redirect_to bucket_bubble_url(@bucket, @bubble)
redirect_to bucket_bubble_path(@bucket, @bubble)
end
def destroy
+1 -1
View File
@@ -10,7 +10,7 @@ class UsersController < ApplicationController
def create
user = @account.users.create!(user_params)
start_new_session_for user
redirect_to root_url
redirect_to root_path
end
private