Advertisement
Guest User

Untitled

a guest
May 19th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. class Search < ApplicationRecord
  2. def self.search_posts(keywords)
  3. posts = Post.all
  4. posts = posts.where(["title LIKE ?", "%#{keywords}%"]) if keywords.present?
  5. return posts
  6.  
  7. end
  8. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement