#926: redirect to #show page when platform_id or product_id doesn't exist

This commit is contained in:
Vokhmin Alexey V 2013-02-15 18:22:57 +04:00
parent a364fe9cd1
commit 56b47715e6
2 changed files with 9 additions and 1 deletions

View File

@ -2,6 +2,14 @@
class Platforms::ProductBuildListsController < Platforms::BaseController
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:index, :show, :log] if APP_CONFIG['anonymous_access']
before_filter lambda{
if params[:platform_id].blank? || params[:product_id].blank?
pbl = ProductBuildList.find params[:id]
product = pbl.product
platform = product.platform
redirect_to platform_product_product_build_list_path(platform, product, pbl)
end
}, :only => :show
load_and_authorize_resource :platform, :except => :index
load_and_authorize_resource :product, :through => :platform, :except => :index
load_and_authorize_resource :product_build_list, :through => :product, :except => :index

View File

@ -173,7 +173,7 @@ Rosa::Application.routes.draw do
end
match '/private/:platform_name/*file_path' => 'privates#show'
resources :product_build_lists, :only => [:index]
resources :product_build_lists, :only => [:index, :show]
end
resources :autocompletes, :only => [] do