mirror of
https://github.com/wahyd4/libr-2.git
synced 2026-08-09 05:15:53 +10:00
17 lines
514 B
Ruby
17 lines
514 B
Ruby
class Api::V1::SearchController < ApplicationController
|
|
|
|
skip_before_action :authenticate_user_from_token
|
|
|
|
def index
|
|
#.pluck(:id, :title, :url, :type, :good_format, :summary)
|
|
posts = Post.select(Post.json_attrs).where('title LIKE ?',"%#{params[:keywords]}%").limit(5)
|
|
#.pluck(:id, :email, :name, :avatar)
|
|
users = User.select(User.json_attrs).where('name LIKE ?', "%#{params[:keywords]}%").limit(5)
|
|
render json: {
|
|
posts: posts,
|
|
users: users
|
|
}
|
|
end
|
|
|
|
end
|