Skip to content

Instantly share code, notes, and snippets.

@xwmx
Created January 9, 2009 21:08
Show Gist options
  • Save xwmx/45282 to your computer and use it in GitHub Desktop.
Save xwmx/45282 to your computer and use it in GitHub Desktop.
ActiveRecord Monkeypatching
class << ActiveRecord::Base
def paged_find_tagged_with(tags, args = {})
tags.nil? ? paginate(args) : paginate_tagged_with(tags, args)
end
def concerned_with(*concerns)
concerns.each do |concern|
require_dependency "#{name.underscore}/#{concern}"
end
end
end
class ActiveRecord::Base
def to_type
self.class.name.downcase
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment