Created
December 17, 2011 02:59
-
-
Save allenwei/1488988 to your computer and use it in GitHub Desktop.
Include Module in Class
This file contains 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
class User | |
include UserModules::Invitation | |
end | |
module UserModules::Invitation | |
extend ActiveSupport::Concern | |
included do | |
validate :validate_invitation_code | |
after_create :apply_invitation_code | |
has_one :invitation, :class_name => "InvitationCode" | |
end | |
def validate_invitation_code | |
true | |
end | |
def apply_invitation_code | |
# do something | |
end | |
module ClassMethods | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment