Monday, August 16, 2010

[Rails] 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:

----
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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate