I have the following route in my routes.rb: map.resources :start, :member => { :about => :get } The first problem is that Rails won''t let me add :only => [:index, :about] However the bigger problem is that when following a link in an image map I get the following error: Unknown action No action responded to show. Actions: about and index Here is the relevant area tag: <area shape="rect" coords="385,0,450,27" href="/start/about" alt="About"> As far as I can tell I should have a route for start/about using GET however Rails is convinced I want the show method, which I am unaware I was asking for.
Hi Glen, On Mon, 2009-08-24 at 18:41 -0700, Glen wrote:> I have the following route in my routes.rb: > > map.resources :start, :member => { :about => :get } > > The first problem is that Rails won''t let me add :only => > [:index, :about] > > However the bigger problem is that when following a link in an image > map I get the following error: > > > Unknown action > > No action responded to show. Actions: about and index > > > Here is the relevant area tag: > > <area shape="rect" coords="385,0,450,27" href="/start/about" > alt="About"> > > > As far as I can tell I should have a route for start/about using GET > however Rails is convinced I want the show method, which I am unaware > I was asking for.Have you tried running ''rake routes'' to see what routes you''ve actually created? Why don''t you start with that and then, maybe, ask something like ''Here''s what I''ve done and what it''s created. What do I need to do to create a route that will work with this area tag I want to use?'' Best regards, Bill
Hi Glen, When I wish to map a particular action apart from the standard one, I use the following route : map.resources :start, :collection => { :about=> :get } Perhaps that should help you. Thanks & Regards, Dhruva Sagar. Ogden Nash <http://www.brainyquote.com/quotes/authors/o/ogden_nash.html> - "The trouble with a kitten is that when it grows up, it''s always a cat." On Tue, Aug 25, 2009 at 7:11 AM, Glen <damnbigman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I have the following route in my routes.rb: > > map.resources :start, :member => { :about => :get } > > The first problem is that Rails won''t let me add :only => > [:index, :about] > > However the bigger problem is that when following a link in an image > map I get the following error: > > > Unknown action > > No action responded to show. Actions: about and index > > > Here is the relevant area tag: > > <area shape="rect" coords="385,0,450,27" href="/start/about" > alt="About"> > > > As far as I can tell I should have a route for start/about using GET > however Rails is convinced I want the show method, which I am unaware > I was asking for. > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Glen, map.resources :start, :member => { :about => :get } will produces / start/:id/about map.resources :start, :collection => { :about => :get } will get you / start/about Maybe you want to change that and see if it works since your link is href="/start/about" Cheers! Arzumy On Aug 25, 10:42 am, bill walton <bwalton...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Glen, > > > > On Mon, 2009-08-24 at 18:41 -0700, Glen wrote: > > I have the following route in my routes.rb: > > > map.resources :start, :member => { :about => :get } > > > The first problem is that Rails won''t let me add :only => > > [:index, :about] > > > However the bigger problem is that when following a link in an image > > map I get the following error: > > > Unknown action > > > No action responded to show. Actions: about and index > > > Here is the relevant area tag: > > > <area shape="rect" coords="385,0,450,27" href="/start/about" > > alt="About"> > > > As far as I can tell I should have a route for start/about using GET > > however Rails is convinced I want the show method, which I am unaware > > I was asking for. > > Have you tried running ''rake routes'' to see what routes you''ve actually > created? > > Why don''t you start with that and then, maybe, ask something like > ''Here''s what I''ve done and what it''s created. What do I need to do to > create a route that will work with this area tag I want to use?'' > > Best regards, > Bill
Thanks guys that worked. I can also use only with a collection route. However I''m still puzzled as to why only doesn''t work with a member route does the syntax just need to be more exact for a member route? For example something like :only => [:index, :start/:id/:about]? On Aug 24, 9:00 pm, Dhruva Sagar <dhruva.sa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Glen, > When I wish to map a particular action apart from the standard one, I use > the following route : > > map.resources :start, :collection => { :about=> :get } > > Perhaps that should help you. > > Thanks & Regards, > Dhruva Sagar. > > Ogden Nash <http://www.brainyquote.com/quotes/authors/o/ogden_nash.html> - > "The trouble with a kitten is that when it grows up, it''s always a cat." > > On Tue, Aug 25, 2009 at 7:11 AM, Glen <damnbig...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I have the following route in my routes.rb: > > > map.resources :start, :member => { :about => :get } > > > The first problem is that Rails won''t let me add :only => > > [:index, :about] > > > However the bigger problem is that when following a link in an image > > map I get the following error: > > > Unknown action > > > No action responded to show. Actions: about and index > > > Here is the relevant area tag: > > > <area shape="rect" coords="385,0,450,27" href="/start/about" > > alt="About"> > > > As far as I can tell I should have a route for start/about using GET > > however Rails is convinced I want the show method, which I am unaware > > I was asking for.