Revisions

gist: 213712 Download_button fork
public
Public Clone URL: git://gist.github.com/213712.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
classs User < ActiveRecord::Base
  def accepted_debates
    [Claim, Game, Fantasy].inject([]) { |all_debates, debate_type| all_debates + debate_type.find(:all, :conditions => ['(opponent_id = ? OR user_id = ?) AND state IN (?)', id, id, Debatable::IN_PROGRESS_STATES])}
  end
end