# Respond\_to json gives error: no route matches "/schedules/list.json" with {:method=\>:get}

**URL:** <https://www.ruby-forum.com/t/respond-to-json-gives-error-no-route-matches-schedules-list-json-with-method-get/193389>\
**Category:** Rails\
**Created:** [August 16, 2010, 11:09pm UTC](https://www.ruby-forum.com/t/respond-to-json-gives-error-no-route-matches-schedules-list-json-with-method-get/193389 "2010-08-16T23:09:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![neigaard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/41988e/32.png) [@neigaard](https://www.ruby-forum.com/u/neigaard)\
**Post date:** [August 16, 2010, 11:09pm UTC](https://www.ruby-forum.com/t/respond-to-json-gives-error-no-route-matches-schedules-list-json-with-method-get/193389/1 "2010-08-16T23:09:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![neigaard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/41988e/32.png) [@neigaard](https://www.ruby-forum.com/u/neigaard)\
**Post date:** [August 17, 2010, 8:58am UTC](https://www.ruby-forum.com/t/respond-to-json-gives-error-no-route-matches-schedules-list-json-with-method-get/193389/2 "2010-08-17T08:58:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![neigaard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/41988e/32.png) [@neigaard](https://www.ruby-forum.com/u/neigaard)\
**Post date:** [August 17, 2010, 2:02pm UTC](https://www.ruby-forum.com/t/respond-to-json-gives-error-no-route-matches-schedules-list-json-with-method-get/193389/3 "2010-08-17T14:02:47Z")

</div>

Bumping this, I need some help please 🙂

---

<div class="post-metadata">

**Author:** ![neigaard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/41988e/32.png) [@neigaard](https://www.ruby-forum.com/u/neigaard)\
**Post date:** [August 16, 2010, 11:35pm UTC](https://www.ruby-forum.com/t/respond-to-json-gives-error-no-route-matches-schedules-list-json-with-method-get/193389/4 "2010-08-16T23:35:15Z")

</div>

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,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![neigaard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/41988e/32.png) [@neigaard](https://www.ruby-forum.com/u/neigaard)\
**Post date:** [August 19, 2010, 2:22pm UTC](https://www.ruby-forum.com/t/respond-to-json-gives-error-no-route-matches-schedules-list-json-with-method-get/193389/5 "2010-08-19T14:22:55Z")

</div>

neigaard wrote:

> Bumping this, I need some help please 🙂

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