universal_table/app/models/column_entry.rb

26 lines
663 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-20 00:45:45 +00:00
belongs_to :table_entry, index: true
belongs_to :table_column, index: true
2024-07-14 14:57:37 +00:00
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