Skip to content

Instantly share code, notes, and snippets.

@matthuhiggins
Created May 28, 2010 07:25
Show Gist options
  • Save matthuhiggins/416873 to your computer and use it in GitHub Desktop.
Save matthuhiggins/416873 to your computer and use it in GitHub Desktop.
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