Skip to content

Instantly share code, notes, and snippets.

# Behavior filter turns method names into select/reject filters
# Example
# class User
# has_manny :comments, :extend => BehaviorFilter
# end
module BehaviorFilter
# creates magic methods like these
# user.comments.from_blocked_commentors
# # => user.comments.select{ |c| user.blocking?(c.commentor) }