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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With