Created
March 18, 2015 12:10
-
-
Save huydx/11315cbc23f3fbad893f to your computer and use it in GitHub Desktop.
foo.rb
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
#read_onlyコラムを追加 | |
class Follow < ActiveRecord::Base | |
before_update :validate_read_only | |
before_create :set_read_only | |
def set_read_only | |
self.read_only = true | |
end | |
def validate_read_only | |
if self.read_only | |
return false | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment