i am trying to create an app with angular and rails.as a first step i am
trying my controller to give json response , in which i am failing with
the below error
Completed 406 Not Acceptable in 26.0ms
my controller-------
class TodosController < ApplicationController
respond_to :json
def index
#respond_with :@todo
@todo=Todo.all
respond_to do |format|
format.json { render :json => @todo}
end
end
end
routes.rb------
resources :todos
gemfile--------
source ‘https://rubygems.org’
gem ‘rails’, ‘3.2.17’
gem ‘pry-nav’
Bundle edge Rails instead:
gem ‘rails’, :git => ‘git://github.com/rails/rails.git’
gem ‘activerecord-jdbcsqlite3-adapter’
gem ‘jruby-openssl’
group :development, :test do
gem ‘ffaker’
gem ‘factory_girl_rails’
gem ‘rspec-rails’
gem ‘shoulda’
gem ‘shoulda-matchers’
end
Gems used only for assets and not required
in production environments by default.
group :assets do
gem ‘sass-rails’, ‘~> 3.2.3’
gem ‘coffee-rails’, ‘~> 3.2.1’
See https://github.com/sstephenson/execjs#readme for more supported
runtimes
gem ‘therubyrhino’
gem ‘uglifier’, ‘>= 1.0.3’
end
gem ‘jquery-rails’