2005-12-11 13:06:51 -05:00
|
|
|
class Categorization < ActiveRecord::Base
|
|
|
|
belongs_to :post
|
2015-04-07 03:50:32 -04:00
|
|
|
belongs_to :category, counter_cache: true
|
2016-08-06 12:26:20 -04:00
|
|
|
belongs_to :named_category, :class_name => "Category", :foreign_key => :named_category_name, :primary_key => :name
|
2005-12-11 13:06:51 -05:00
|
|
|
belongs_to :author
|
2010-10-31 07:21:28 -04:00
|
|
|
|
2010-10-14 08:16:47 -04:00
|
|
|
has_many :post_taggings, :through => :author, :source => :taggings
|
2011-03-02 16:24:56 -05:00
|
|
|
|
2016-08-06 12:26:20 -04:00
|
|
|
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
|
2010-12-12 12:03:41 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
class SpecialCategorization < ActiveRecord::Base
|
2016-08-06 12:26:20 -04:00
|
|
|
self.table_name = "categorizations"
|
2012-03-21 18:18:18 -04:00
|
|
|
default_scope { where(:special => true) }
|
2010-12-12 12:03:41 -05:00
|
|
|
|
|
|
|
belongs_to :author
|
|
|
|
belongs_to :category
|
2010-10-14 08:16:47 -04:00
|
|
|
end
|