asia_database/app/models/asia_paper.rb

12 lines
454 B
Ruby

class AsiaPaper
include Mongoid::Document
include Mongoid::Timestamps
include Slug
field :paper_name, :type => String, :default => "", :localize => true, :as => :slug_title
field :issue_year, :type => String
field :journal_name, :type => String, :default => "", :localize => true
field :rss2_id
belongs_to :asia_teacher, index: true
scope :sort_order, ->{order({issue_year: -1})}
index({issue_year: -1}, { unique: false, background: true })
end