aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/categorization.rb
blob: fdb0a1154097f32701001af6c951357eeadd6d3f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class Categorization < ActiveRecord::Base
  belongs_to :post
  belongs_to :category
  belongs_to :author

  belongs_to :author_using_custom_pk,  :class_name => 'Author', :foreign_key => :author_id, :primary_key => :author_address_extra_id
  has_many   :authors_using_custom_pk, :class_name => 'Author', :foreign_key => :id,        :primary_key => :category_id
end

class SpecialCategorization < ActiveRecord::Base
  self.table_name = 'categorizations'

  default_scope where(:special => true)

  belongs_to :author
  belongs_to :category
end