David Kahn
2011-Mar-16 16:06 UTC
Stumped on routing - getting ''no route matches'' error but route exists AFAIK
Stumped on this, can anyone help: When I ask for ''accept_invitation_url'', I get: ActionController::RoutingError Exception: No route matches {:controller=>"invitations", :action=>"accept"} However as far as I can tell it should exist. I dont get it. I have virtually the same structure with another app and it works fine. class InvitationsController < ApplicationController ... def accept @invitation = Invitation.find_by_token(params[:token]) end end MyApp::Application.routes.draw do ... resources :invitations match "/invitations/accept/:token" => "invitations#accept", :as => :accept_invitation ... end -- 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.
Jazmin
2011-Mar-16 16:35 UTC
Re: Stumped on routing - getting ''no route matches'' error but route exists AFAIK
A little trick is to type rake routes in your terminal to view the routes available. but it seems that you should be able to call accept_invitation_url(:token => "your token") -J On Wed, Mar 16, 2011 at 11:06 AM, David Kahn <dk-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org>wrote:> Stumped on this, can anyone help: > > When I ask for ''accept_invitation_url'', I get: > ActionController::RoutingError Exception: No route matches > {:controller=>"invitations", :action=>"accept"} > > However as far as I can tell it should exist. I dont get it. I have > virtually the same structure with another app and it works fine. > > > class InvitationsController < ApplicationController > ... > def accept > @invitation = Invitation.find_by_token(params[:token]) > end > end > > > MyApp::Application.routes.draw do > ... > resources :invitations > match "/invitations/accept/:token" => "invitations#accept", :as => > :accept_invitation > ... > end > > -- > 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. >-- Jazmin -- 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.
David Kahn
2011-Mar-16 17:04 UTC
Re: Stumped on routing - getting ''no route matches'' error but route exists AFAIK
On Wed, Mar 16, 2011 at 10:35 AM, Jazmin <jazminschroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> A little trick is to type rake routes in your terminal to view the routes > available. > but it seems that you should be able to call accept_invitation_url(:token > => "your token") >Thanks, I had looked at rake routes before and again now.... so it is really bizarre: (rdb:1) accept_band_invitation_url ActionController::RoutingError Exception: No route matches {:controller=>"accounts", :action=>"new"} Yet in my rake routes new_account GET /accounts/new(.:format) {:action=>"new", :controller=>"accounts"} accept_band_invitation /accept_band_invitation/:token(.:format) {:controller=>"accounts", :action=>"new"} Guess I can just hand code the url but I hate not understanding what is wrong.> > -J > > > > On Wed, Mar 16, 2011 at 11:06 AM, David Kahn <dk-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org>wrote: > >> Stumped on this, can anyone help: >> >> When I ask for ''accept_invitation_url'', I get: >> ActionController::RoutingError Exception: No route matches >> {:controller=>"invitations", :action=>"accept"} >> >> However as far as I can tell it should exist. I dont get it. I have >> virtually the same structure with another app and it works fine. >> >> >> class InvitationsController < ApplicationController >> ... >> def accept >> @invitation = Invitation.find_by_token(params[:token]) >> end >> end >> >> >> MyApp::Application.routes.draw do >> ... >> resources :invitations >> match "/invitations/accept/:token" => "invitations#accept", :as => >> :accept_invitation >> ... >> end >> >> -- >> 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. >> > > > > -- > Jazmin > > -- > 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. >-- 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.
Jim Ruther Nill
2011-Mar-17 00:46 UTC
Re: Stumped on routing - getting ''no route matches'' error but route exists AFAIK
On Thu, Mar 17, 2011 at 1:04 AM, David Kahn <dk-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org>wrote:> > > On Wed, Mar 16, 2011 at 10:35 AM, Jazmin <jazminschroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > >> A little trick is to type rake routes in your terminal to view the routes >> available. >> but it seems that you should be able to call accept_invitation_url(:token >> => "your token") >> > > Thanks, I had looked at rake routes before and again now.... so it is > really bizarre: > > (rdb:1) accept_band_invitation_url > ActionController::RoutingError Exception: No route matches > {:controller=>"accounts", :action=>"new"} > > Yet in my rake routes > > new_account GET /accounts/new(.:format) > {:action=>"new", :controller=>"accounts"} > > accept_band_invitation /accept_band_invitation/:token(.:format) > {:controller=>"accounts", :action=>"new"} > >Are you passing a :token parameter to the named route? ie. accept_band_invitation_url(''this-is-my-token'')> > Guess I can just hand code the url but I hate not understanding what is > wrong. > > >> >> -J >> >> >> >> On Wed, Mar 16, 2011 at 11:06 AM, David Kahn <dk-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org>wrote: >> >>> Stumped on this, can anyone help: >>> >>> When I ask for ''accept_invitation_url'', I get: >>> ActionController::RoutingError Exception: No route matches >>> {:controller=>"invitations", :action=>"accept"} >>> >>> However as far as I can tell it should exist. I dont get it. I have >>> virtually the same structure with another app and it works fine. >>> >>> >>> class InvitationsController < ApplicationController >>> ... >>> def accept >>> @invitation = Invitation.find_by_token(params[:token]) >>> end >>> end >>> >>> >>> MyApp::Application.routes.draw do >>> ... >>> resources :invitations >>> match "/invitations/accept/:token" => "invitations#accept", :as => >>> :accept_invitation >>> ... >>> end >>> >>> -- >>> 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. >>> >> >> >> >> -- >> Jazmin >> >> -- >> 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. >> > > -- > 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. >-- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.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.