Preparing our models to be searched
The acts_as_event
plugin is used internally by Redmine in order to maintain consistency between various models that need to be grouped together.
In our case, the models that are being searched need to have acts_as_event
implemented in order to determine what constitutes a title, how the title will be formatted, what the description field is, and so on.
Note that acts_as_event
is a dependency of acts_as_searchable
; therefore, if it isn't included in our model, Redmine will crash when a search is attempted.
The function prototype for acts_as_event
is a standard class method that accepts an options hash:
def acts_as_event(options = {})
As we'll be marking our knowledgebase articles as searchable, we will begin by adding acts_as_event
to our article model:
class KbArticle < ActiveRecord::Base # ... acts_as_event :datetime => :updated_at, :description => :summary, :title => Proc.new { |o| "#{l(:label_title_articles...