Permalink
Browse files

If page routes just specify :path not :id we can simplify the PagesCo…

…ntroller#show significantly.
  • Loading branch information...
parndt committed Feb 6, 2011
1 parent cf1b606 commit aad317cb06cca9de755ed56d189f9a761b83a64e
Showing with 3 additions and 4 deletions.
  1. +1 −1 Gemfile.lock
  2. +1 −2 pages/app/controllers/pages_controller.rb
  3. +1 −1 pages/config/routes.rb
View
@@ -135,7 +135,7 @@ GEM
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
- rdoc (3.5.1)
+ rdoc (3.5.2)
refinerycms-generators (0.9.9.2)
refinerycms (>= 0.9.9)
refinerycms-i18n (0.9.9.7)
@@ -16,8 +16,7 @@ def home
# GET /about/mission
#
def show
- # Find the page by the newer 'path' or fallback to the page's id if no path.
- @page = Page.find(params[:path] ? params[:path].to_s.split('/').last : params[:id])
+ @page = Page.find(params[:path].to_s.split('/').last)
if @page.try(:live?) or (refinery_user? and current_user.authorized_plugins.include?("refinery_pages"))
# if the admin wants this to be a "placeholder" page which goes to its first child, go to that instead.
View
@@ -1,5 +1,5 @@
::Refinery::Application.routes.draw do
- get '/pages/:id', :to => 'pages#show', :as => :page
+ get '/pages/:path', :to => 'pages#show', :as => :page
scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
resources :pages, :except => :show do

0 comments on commit aad317c

Please sign in to comment.