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?
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