universal_table/app/models/column_entry.rb

26 lines
711 B
Ruby
Raw Normal View History

2015-11-13 13:10:00 +00:00
class ColumnEntry
include Mongoid::Document
include Mongoid::Timestamps
field :text, :localize => true
field :content, :localize => true
field :date, type: DateTime
field :period_from, type: DateTime
field :period_to, type: DateTime
2022-02-25 06:49:00 +00:00
field :number, type: Integer
2015-11-13 13:10:00 +00:00
mount_uploader :image, ImageUploader
2024-07-14 14:57:37 +00:00
belongs_to :table_entry, :dependent => :destroy, index: true
belongs_to :table_column, :dependent => :destroy, index: true
I18n.available_locales.each do |locale|
index({text: 1}, { collation: {locale: locale.to_s}, unique: false, background: true })
index({content: 1}, { collation: {locale: locale.to_s}, unique: false, background: true })
end
2015-11-13 13:10:00 +00:00
def type
self.table_column.type
2022-02-25 06:49:00 +00:00
end
2015-11-13 13:10:00 +00:00
end