File: categorization.rb

package info (click to toggle)
rails 2%3A7.2.2.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 43,348 kB
  • sloc: ruby: 349,797; javascript: 30,703; yacc: 46; sql: 43; sh: 29; makefile: 27
file content (21 lines) | stat: -rw-r--r-- 748 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

class Categorization < ActiveRecord::Base
  belongs_to :post
  belongs_to :category, counter_cache: true
  belongs_to :named_category, class_name: "Category", foreign_key: :named_category_name, primary_key: :name
  belongs_to :author

  has_many :post_taggings, through: :author, source: :taggings

  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