Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Search < ApplicationRecord
- def self.search_posts(keywords)
- posts = Post.all
- posts = posts.where(["title LIKE ?", "%#{keywords}%"]) if keywords.present?
- return posts
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement