|
|
|
|
@ -4,6 +4,7 @@ class Annotation < ApplicationRecord
|
|
|
|
|
belongs_to :doctrine, optional: false |
|
|
|
|
|
|
|
|
|
belongs_to :document, polymorphic: true, optional: false |
|
|
|
|
has_one :library, through: :document |
|
|
|
|
|
|
|
|
|
has_many :annotation_documents, inverse_of: :annotation, dependent: :destroy |
|
|
|
|
accepts_nested_attributes_for :annotation_documents, allow_destroy: true |
|
|
|
|
@ -33,6 +34,10 @@ class Annotation < ApplicationRecord
|
|
|
|
|
integer :document_id |
|
|
|
|
integer :doctrine_id |
|
|
|
|
|
|
|
|
|
join(:library_rank, target: Cdao::Document, type: :integer, join: { from: :id, to: :document_id }) |
|
|
|
|
join(:search_year, target: Cdao::Document, type: :integer, join: { from: :id, to: :document_id }) |
|
|
|
|
join(:search_doc_date, target: Cdao::Document, type: :date, join: { from: :id, to: :document_id }) |
|
|
|
|
|
|
|
|
|
date :created_at |
|
|
|
|
date :updated_at |
|
|
|
|
|
|
|
|
|
|