Skip to content

Instantly share code, notes, and snippets.

@vojto
Created May 15, 2010 19:31
Show Gist options
  • Save vojto/402363 to your computer and use it in GitHub Desktop.
Save vojto/402363 to your computer and use it in GitHub Desktop.
module ServesPages
def show
path = path_for(params[:id])
unless File.exists?(path)
path = path_for("not_found")
end
@page = File.read(path)
render :text => @page, :layout => true
end
protected
def path_for(page)
"#{Rails.root}/app/pages/#{page}.html"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment