Created
May 28, 2010 07:25
-
-
Save matthuhiggins/416873 to your computer and use it in GitHub Desktop.
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
module Awesomeness | |
def self.include(model_klass) | |
model_klass.class_eval do | |
extend ClassMethods | |
include InstanceMethods | |
named_scope :awesome, :conditions => {:favorite_language => 'ruby'} | |
end | |
end | |
module ClassMethods | |
def make_everyone_awesome | |
update_all(:favorite_language => 'ruby') | |
end | |
end | |
module InstanceMethods | |
def awesome? | |
favorite_language == 'ruby' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment