forked from OpenNeo/impress
create /start/:species_name/:color_name route
This commit is contained in:
parent
b2a7e0a1d5
commit
71da64b47f
3 changed files with 15 additions and 0 deletions
|
@ -15,6 +15,10 @@ class ApplicationController < ActionController::Base
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def not_found(record_name='record')
|
||||||
|
raise ActionController::RoutingError.new("#{record_name} not found")
|
||||||
|
end
|
||||||
|
|
||||||
class AccessDenied < StandardError;end
|
class AccessDenied < StandardError;end
|
||||||
|
|
||||||
rescue_from AccessDenied, :with => :on_access_denied
|
rescue_from AccessDenied, :with => :on_access_denied
|
||||||
|
|
|
@ -70,6 +70,16 @@ class OutfitsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def start
|
||||||
|
@species = Species.find_by_name params[:species_name]
|
||||||
|
@color = Color.find_by_name params[:color_name]
|
||||||
|
if @species && @color
|
||||||
|
redirect_to wardrobe_path(:species => @species.id, :color => @color.id)
|
||||||
|
else
|
||||||
|
not_found('species/color')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @outfit.update_attributes(params[:outfit])
|
if @outfit.update_attributes(params[:outfit])
|
||||||
render :json => true
|
render :json => true
|
||||||
|
|
|
@ -74,6 +74,7 @@ OpenneoImpressItems::Application.routes.draw do |map|
|
||||||
match 'users/top_contributors' => redirect('/users/top-contributors')
|
match 'users/top_contributors' => redirect('/users/top-contributors')
|
||||||
|
|
||||||
match '/wardrobe' => 'outfits#edit', :as => :wardrobe
|
match '/wardrobe' => 'outfits#edit', :as => :wardrobe
|
||||||
|
match '/start/:color_name/:species_name' => 'outfits#start'
|
||||||
|
|
||||||
match '/donate' => 'static#donate', :as => :donate
|
match '/donate' => 'static#donate', :as => :donate
|
||||||
match 'image-mode' => 'static#image_mode', :as => :image_mode
|
match 'image-mode' => 'static#image_mode', :as => :image_mode
|
||||||
|
|
Loading…
Reference in a new issue