summaryrefslogtreecommitdiff
path: root/vendor/plugins/will_paginate/test/fixtures/project.rb
blob: 0f85ef5eaab2d8e896806b2c0faab7f8b49bf77c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Project < ActiveRecord::Base
  has_and_belongs_to_many :developers, :uniq => true
  
  has_many :topics
    # :finder_sql  => 'SELECT * FROM topics WHERE (topics.project_id = #{id})',
    # :counter_sql => 'SELECT COUNT(*) FROM topics WHERE (topics.project_id = #{id})'
  
  has_many :replies, :through => :topics do
    def find_recent(params = {})
      with_scope :find => { :conditions => ['replies.created_at > ?', 15.minutes.ago] } do
        find :all, params
      end
    end
  end
end