Skip to content

Instantly share code, notes, and snippets.

@neilmiddleton
Last active December 14, 2015 14:28
Show Gist options
  • Save neilmiddleton/5100375 to your computer and use it in GitHub Desktop.
Save neilmiddleton/5100375 to your computer and use it in GitHub Desktop.
read_only
module ActiveRecord
class Base
def read_only?
ENV["AR_READ_ONLY"] ||= false
end
def before_destroy
raise ActiveRecord::ReadOnlyRecord if read_only?
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment