So why would I be getting this error and why its pointing to localhost instead of localhost:3000?
Completed in 27ms (View: 3, DB: 13) | 406 Not Acceptable [http://localhost/sessions.json]
I am trying to use ObjectiveResource (iphone app) and Rails. ObjectiveResource points to sessions.json with a Post I guess when creating a session.
In my routes file I am using
map.resources :sessions
map.connect ':controller.:format'
map.conn开发者_如何学Cect ':controller/:action.:format'
in your routes.rb you only need this:
map.resources :sessions
Your path is correct but you need responds_to
block in the action
def create
Session.create(params[:session])
responds_to do |format|
format.json
end
end
You need to register json as a Mime Type. Check that in the file app_root/config/initializers/mime_types.rb
you have a line like:
Mime::Type.register_alias "application/json", :json
精彩评论