redmine_glossary/app/models/glossary_term.rb

10 lines
253 B
Ruby
Raw Normal View History

2018-04-30 15:28:18 +02:00
class GlossaryTerm < ActiveRecord::Base
belongs_to :category, class_name: 'GlossaryCategory', foreign_key: 'category_id'
belongs_to :project
scope :search_by_name, -> (keyword) {
where 'name like ?', "#{sanitize_sql_like(keyword)}%"
}
2018-04-30 15:28:18 +02:00
end