Froze rails gems
[depot.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 :posts_gruoped_by_title, :class_name => "Post", :group => "title", :select => "title"
18
19 def self.what_are_you
20 'a category...'
21 end
22
23 has_many :categorizations
24 has_many :authors, :through => :categorizations, :select => 'authors.*, categorizations.post_id'
25 end
26
27 class SpecialCategory < Category
28
29 def self.what_are_you
30 'a special category...'
31 end
32
33 end