mirror of
https://github.com/wahyd4/Libr.git
synced 2026-08-09 04:46:07 +10:00
17 lines
281 B
Ruby
17 lines
281 B
Ruby
class BookController < ApplicationController
|
|
|
|
def view
|
|
@book = Book.find_by_id params[:id]
|
|
end
|
|
|
|
def search
|
|
unless params[:arg] == nil
|
|
@books = Book.where("name like ?","%#{params[:arg]}%")
|
|
render json: @books
|
|
else
|
|
render json: {msg:'wrong'}
|
|
end
|
|
|
|
end
|
|
end
|