I try to tell rails 3.2 that it should render JSON by default, and kick HTML completely like this:
respond_to :json
def index
@clients = Client.all
respond_with @clients
end
With this syntax, I have to add .json
to the URL. How can I achieve it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…