Skip to content

Instantly share code, notes, and snippets.

@huydx
Created March 18, 2015 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huydx/11315cbc23f3fbad893f to your computer and use it in GitHub Desktop.
Save huydx/11315cbc23f3fbad893f to your computer and use it in GitHub Desktop.
foo.rb
#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