neigaard
2010-Aug-16 21:08 UTC
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
Marnen Laibow-Koser
2010-Aug-16 21:35 UTC
Re: respond_to json gives error: no route matches "/schedules/list.json" with {:method=>:get}
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�renProbably -- 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 marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
neigaard
2010-Aug-17 06:57 UTC
Re: respond_to json gives error: no route matches "/schedules/list.json" with {:method=>:get}
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 -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
neigaard
2010-Aug-17 12:01 UTC
Re: respond_to json gives error: no route matches "/schedules/list.json" with {:method=>:get}
Bumping this, I need some help please :) -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Mikael Björkegren
2010-Aug-19 12:22 UTC
Re: respond_to json gives error: no route matches "/schedules/list.json" with {:method=>:get}
neigaard wrote:> Bumping this, I need some help please :)Do you have list.json.erb file in your app/view/ ? -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.