Skip to content

Commit e61ca3f

Browse files
committed
added basic Category#searchg class method
1 parent d2c5128 commit e61ca3f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/models/category.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,8 @@ def self.by_id(id)
6767
end
6868
categories[id]
6969
end
70+
71+
def self.search(term)
72+
where('name LIKE ?', "%#{sanitize_sql_like(term)}%")
73+
end
7074
end

0 commit comments

Comments
 (0)