Dynamic routing
resources :categories
scope '/:categoryalias', :constraints => CategoryConstraint do
get '' => 'posts#index'
get '/:postalias' => 'posts#show'
end
class CategoryConstraint
def self.matches?(request)
Category.where(alias: request.path_parameters[:categoryalias]).first
end
end