respond_to json gives error: no route matches "/schedules/list.json" with {:method=>:get}

Hi

I am a newbie trying to make a webservice that talks JSON. I have this in my controller:

neigaard wrote:

Hi

I am a newbie trying to make a webservice that talks JSON. I have this in my controller:

---- class SchedulesController < ApplicationController   def list     @schedules = Schedules.all     respond_to do |format|       format.html # list.html.erb       format.json { render :json => @schedules.to_json }     end   end end ----

I have nothing special in my routes, but should the default map.connect ':controller/:action/:id.:format' not handle this for me?

Thank you S�ren

Probably -- have you tried? If it did not work, what errors did you get? Which automated tests failed?

When you say you have "nothing special" in your routes, what does that mean? What does your routes.rb file look like?

Best,

I mean I only have the default routes, that also includes the route in my first post. Here is my routes.rb:

ActionController::Routing::Routes.draw do |map|   map.connect ':controller/:action/:id'   map.connect ':controller/:action/:id.:format' end

Any ideas? Thank you Søren

Bumping this, I need some help please :slight_smile:

neigaard wrote:

Bumping this, I need some help please :slight_smile:

Do you have list.json.erb file in your app/view/ ?