Return to Snippet

Revision: 23889
at February 16, 2010 13:55 by nate63179


Initial Code
class PagesController < ApplicationController
  
  layout 'default'
  
  def index
  end
  
  def show
    action_name = params[:path].join('/')
    if page_exist?(action_name)
      render :action => action_name
    else 
      render :action => "pages/404", :layout => true, :status => 404
    end
  end
  
  private
  
  def page_exist?(page_name)
    file_path = File.join(RAILS_ROOT, "app", "views", "pages", "#{page_name}.html.erb")
    return true if File.exists?(file_path)
  end
end

Initial URL

                                

Initial Description

                                

Initial Title
Static pages controller

Initial Tags

                                

Initial Language
Ruby