Skip to content

Instantly share code, notes, and snippets.

@thoughtbot
Created August 4, 2009 22:29
Show Gist options
  • Save thoughtbot/162344 to your computer and use it in GitHub Desktop.
Save thoughtbot/162344 to your computer and use it in GitHub Desktop.
class SlideshowsController < ApplicationController
before_filter :authenticate, :authorize
def show
if file_exists?(file)
render :file => file
else
render :nothing => true, :status => 404 and return false
end
end
protected
def file
File.join(directory, "#{params[:id]}.html")
end
def directory
File.join(RAILS_ROOT, "app", "views", "slideshows")
end
def file_exists?(path)
File.file?(path)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment