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?
.json
You can modify your routes.rb files to specify the default format
routes.rb
resources :clients, defaults: {format: :json}
This will modify the default response format for your entire clients_controller
clients_controller
1.4m articles
1.4m replys
5 comments
57.0k users