2018-04-30 15:28:18 +02:00
|
|
|
class GlossaryTerm < ActiveRecord::Base
|
2018-05-06 09:45:27 +02:00
|
|
|
belongs_to :category, class_name: 'GlossaryCategory', foreign_key: 'category_id'
|
2018-05-12 07:26:43 +02:00
|
|
|
belongs_to :project
|
2018-05-19 21:43:22 +02:00
|
|
|
|
|
|
|
scope :search_by_name, -> (keyword) {
|
|
|
|
where 'name like ?', "#{sanitize_sql_like(keyword)}%"
|
|
|
|
}
|
|
|
|
|
2018-06-05 18:21:17 +02:00
|
|
|
scope :search_by_rubi, -> (keyword) {
|
|
|
|
where 'rubi like ?', "#{sanitize_sql_like(keyword)}%"
|
|
|
|
}
|
|
|
|
|
2018-04-30 15:28:18 +02:00
|
|
|
end
|