我想让我的模特干涸;但是太阳黑子只允许一个(1)"可搜索的"在模型中阻止。制作2只是忽略了第二个。下面的失败示例:
digital.rb
class Digital < ActiveRecord::Base
include BaseConcerns
belongs_to :digitable, polymorphic: true
# IGNORES THIS
searchable do
string :url
text :url
string :remark
text :remark
end
end
base_concerns.rb
module BaseConcerns extend ActiveSupport::Concern
included do
before_create{
self.id = UUIDTools::UUID.timestamp_create().to_s.downcase if id.blank?
}
self.primary_key = 'id'
# DOES THIS
searchable do
text :id
time :created_at
time :updated_at
end
end
end
我想使用一些关注来干掉我的模型,并希望可以搜索一些类似命名的列;而我可以指定的其他人;我怎么能这样做?