Skip to content

Commit

Permalink
fix routes
Browse files Browse the repository at this point in the history
  • Loading branch information
loftwah committed Sep 6, 2024
1 parent 0bbbc17 commit 91a595b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Rails.application.routes.draw do
# Static and more specific routes first
get 'analytics/index'

# Routes for users directory (static)
resources :users, only: [:index]

# Devise routes for user registration
Expand All @@ -22,7 +25,7 @@
root to: 'pages#home'

# Routes for achievements
resources :achievements
resources :achievements, only: [:index, :show, :new, :create, :edit, :update, :destroy]

# Routes for links with standard RESTful actions
resources :links do
Expand All @@ -37,7 +40,7 @@
# Dynamic user-specific routes must be last to avoid conflicts with static routes
get '/:username(/:theme)', to: 'links#user_links', as: :user_links,
constraints: {
username: /^(?!(users|analytics|achievements|links|up|sidekiq)$).+/,
username: /(?!users|analytics|achievements|links|up|sidekiq)[a-zA-Z0-9_]+/,
theme: /retro|win95|win98/
}
end

0 comments on commit 91a595b

Please sign in to comment.