Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PagesController < ApplicationController
- verify :params => :name, :only => :show, :redirect_to => :root_url
- before_filter :ensure_valid, :only => :show
- def show
- render :template => "pages/#{current_page}"
- end
- protected
- def current_page
- params[:name].to_s.downcase
- end
- def ensure_valid
- unless template_exists?("pages/#{current_page}.html.erb")
- render :nothing => true, :status => 404 and return false
- end
- end
- end
Add Comment
Please, Sign In to add comment