I'm using rails 4. But I am getting unknown format error. Do you guys have any help for me. Here is my controller:
class EntriesController < ApplicationController
respond_to :json
def index
respond_with Entry.all
end
end
I'm using rails 4. But I am getting unknown format error. Do you guys have any help for me. Here is my controller:
class EntriesController < ApplicationController
respond_to :json
def index
respond_with Entry.all
end
end
Add this to your routes config
resources :entries, defaults: { format: 'json' }
def index
respond_to do |format|
@entry = Entry.all
format.html
format.json { render json: @entry }
end
end
hope it will help you
Add :html
to respond_to
(respond_to :html, :json
) or remove the respond_to
call altogether.