您好我有以下型号
class Tale < ActiveRecord::Base #TODO model should be created automatically based on the structure
attr_accessor :sex, :family, :me
after_initialize do
@sex = nil
@family = []
@me = []
end
before_create do
self.joined = false
true
end
has_many :tale_culture_joins
has_many :tale_purpose_joins
has_many :tale_book_joins
has_many :tale_keyword_joins
has_many :tale_character_joins
has_many :tale_moral_joins
has_many :tale_event_joins
#TODO Grouping models with a unique single identifier that can be searched for as tag. Like these are associations for searching
#TODO need to fix so that on query only uniq results are returned ... can be added @runtime
has_many :cultures, through: :tale_culture_joins, dependent: :destroy
has_many :purposes, through: :tale_purpose_joins, dependent: :destroy
has_many :books, through: :tale_book_joins, dependent: :destroy
has_many :keywords, through: :tale_keyword_joins, dependent: :destroy
has_many :characters, through: :tale_character_joins, dependent: :destroy
has_many :morals, through: :tale_moral_joins, dependent: :destroy
has_many :values, through: :morals
has_many :events, through: :tale_event_joins, dependent: :destroy
has_many :hyperlinks
has_many :content_types, through: :hyperlinks
end
一些反射用于从表单获取和发布数据。 可以看出,价值观与通过道德的故事有关。但是我不会将它存储在tale_value连接表中。
我执行数据输入和搜索功能。想要仅为搜索定义某些反射。如何添加标签|元数据|我可以在以后查看的反思的关键
例如关于has_many:值,通过::道德我想添加选项:searchable ..这对我来说当我构建搜索界面时,我想查询那些可搜索为标签的反射。