Files
Libr/app/controllers/book_controller.rb
T
2013-01-07 17:50:03 +08:00

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