Skip to content

Commit

Permalink
Handle the old archive link
Browse files Browse the repository at this point in the history
  • Loading branch information
hennevogel committed Sep 9, 2014
1 parent e01d25c commit 90475d2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 55 deletions.
12 changes: 12 additions & 0 deletions app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class ProjectsController < ApplicationController
skip_before_filter :authenticate_user!, :only => [ :index, :show, :archived, :finished, :newest, :popular, :biggest ]
skip_before_filter :store_location, :only => [:join, :leave, :like, :dislike, :add_keyword, :delete_keyword ]
skip_before_action :verify_authenticity_token, :only => [:add_keyword, :delete_keyword ]
skip_load_and_authorize_resource :only => :old_archived
before_action :set_episode_id, :only => [:add_episode, :delete_episode]

# GET /projects
Expand Down Expand Up @@ -40,6 +41,17 @@ def show
@new_comment = Comment.new
end

# GET /archive/projects/:id
def old_archived
begin
@project = Project.find_by!(title: params[:id])
redirect_to @project
rescue ActiveRecord::RecordNotFound
flash[:notice] = "Can't find project with title #{params[:id]}"
redirect_to :action => :archived
end
end

# GET /projects/new
def new
@project = Project.new
Expand Down
58 changes: 3 additions & 55 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
end
end

# compat routes
get 'archive/projects/:id', to: "projects#old_archived"

scope '(:episode)' do
resources :projects do
collection do
Expand Down Expand Up @@ -66,59 +69,4 @@
get 'user_root' => 'users#me'
root 'front#index'

# The priority is based upon order of creation:
# first created -> highest priority.

# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action

# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)

# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products

# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end

# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end

# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end

# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end

# You can have the root of your site routed with "root"
# just remember to delete public/index.html.

# See how all your routes lay out with "rake routes"

# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id))(.:format)'
end

0 comments on commit 90475d2

Please sign in to comment.