Updated README.rdoc again
[feedcatcher.git] / vendor / rails / activerecord / test / models / category.rb
1 class Category < ActiveRecord::Base
2 has_and_belongs_to_many :posts
3 has_and_belongs_to_many :special_posts, :class_name => "Post"
4 has_and_belongs_to_many :other_posts, :class_name => "Post"
5 has_and_belongs_to_many :posts_with_authors_sorted_by_author_id, :class_name => "Post", :include => :authors, :order => "authors.id"
6
7 has_and_belongs_to_many(:select_testing_posts,
8 :class_name => 'Post',
9 :foreign_key => 'category_id',
10 :association_foreign_key => 'post_id',
11 :select => 'posts.*, 1 as correctness_marker')
12
13 has_and_belongs_to_many :post_with_conditions,
14 :class_name => 'Post',
15 :conditions => { :title => 'Yet Another Testing Title' }
16
17 has_and_belongs_to_many :popular_grouped_posts, :class_name => "Post", :group => "posts.type", :having => "sum(comments.post_id) > 2", :include => :comments
18 has_and_belongs_to_many :posts_gruoped_by_title, :class_name => "Post", :group => "title", :select => "title"
19
20 def self.what_are_you
21 'a category...'
22 end
23
24 has_many :categorizations
25 has_many :authors, :through => :categorizations, :select => 'authors.*, categorizations.post_id'
26 end
27
28 class SpecialCategory < Category
29
30 def self.what_are_you
31 'a special category...'
32 end
33
34 end