Skip to content

Instantly share code, notes, and snippets.

@bjhaid
Created August 3, 2012 13:31
Show Gist options
  • Save bjhaid/3247725 to your computer and use it in GitHub Desktop.
Save bjhaid/3247725 to your computer and use it in GitHub Desktop.
Application Controller
#The assumption here is a one-to-one mapping between controllers and models
class ApplicationController < ActionController::Base
protect_from_forgery
protected
def db_check
model = self.class.to_s.gsub("Controller", '').singularize
Uploader.csv_loader(model) if eval(model).all.empty?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment