Hello,
I am a beginner when it comes to Ruby on Rails, so I need a little bit of help. I started reading a basic tutorial recently, which was taught using Scaffolding. I made a "Clients" model: script/generate scaffold clients name:string ip_address:string speed:integer ... Inside the clients_controller.rb file, there is a method called show:
# GET /clients/1
# GET /clients/1.xml
def show
@client = Client.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @client }
end
end
For queries, I'd go to localhost:3000/clients/{Enter the ID here}. Instead of searching with the ID are the argument, I'd like to search with another value, like ip_address or speed, so I thought all I would have to do is change :id to :ip_address in "@client = Client.find(params[:id])". However, that does not work, so would someone please tell me how I can achieve a search with another parameter. Thanks!