Created
November 11, 2008 01:43
-
-
Save quinn/23711 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
User < ActiveRecord::Record # thats right | |
has_many :comments | |
has_many :bands | |
def active_comments | |
comments.find :all do |c| | |
c.is_active == true | |
end | |
end | |
# ok that was pretty lame and is pretty much | |
# what ambition does already ( or a named scope ). lets | |
# see if we can't come up with something a little | |
# more interesting than that. | |
def comments_from_my_bands | |
Comment.select do |c| | |
bands.include? c.commentable | |
end | |
end | |
# ok it still doesn't feel like its there yet. its not | |
# blowing my mind yet. how could it blow my mind. . . | |
def comments_on_me_and_my_bands | |
Comment.select do |c| | |
bands.include? c.commentable || | |
c.commentable == self | |
end | |
end | |
# huhh its still not totally awesome yet. idk. | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment