Last active
December 14, 2015 14:28
-
-
Save neilmiddleton/5100375 to your computer and use it in GitHub Desktop.
read_only
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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