寧靜的選擇。如果我在瀏覽器中輸入下面的網址,我得到的客戶記錄列表:現在Rails的url中
http://localhost:5000/clients.json
,我希望能夠通過URL選擇特定的客戶端。是這樣的可能:
http://localhost:5000/clients.json?locname=ys
這是我clients_controller.rb索引:
def index
@clients = Client.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @clients }
end
end
謝謝!
我們可以看到您的clients_controller.rb文件好嗎? – Andrei
我更新了我的問題。 – Reddirt