Anyone have any idea why a named route would NOT work? I did rake routes to make sure it was there and it was but for some reason new_session doesn''t work. -- 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-/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 -~----------~----~----~----~------~----~------~--~---
On 1/16/08, Jimmy Palmer <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Anyone have any idea why a named route would NOT work? I did rake > routes to make sure it was there and it was but for some reason > new_session doesn''t work.What do you mean, didn''t work? If you are looking for a helper method called new_session there isn''t one, the named route will generate two helper methods, in this case new_session_path and new_session_url But maybe you have some other problem. In any case just "doesn''t work" doesn''t help us much. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.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-/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 -~----------~----~----~----~------~----~------~--~---
I changed ''new_session'' in authentication_system.rb to say ''new_session_path'' and it kind of works...it''s not using my routes though. Is this a bug? strange... -- 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-/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 -~----------~----~----~----~------~----~------~--~---
On 1/16/08, Jimmy Palmer <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I changed ''new_session'' in authentication_system.rb to say > ''new_session_path'' and it kind of works...it''s not using my routes > though. Is this a bug?What do you mean "kind of works"? What do you mean "it''s not using my routes"? You gotta tell us more, son! -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.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-/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 -~----------~----~----~----~------~----~------~--~---
sorry for the ambiguity. I will work on being more descriptive. :) In the method access_denied in the file authenticated_system.rb from restful athentication, it generates this: def access_denied respond_to do |format| format.html do store_location redirect_to new_session # <---- NOTICE end format.xml do request_http_basic_authentication ''Web Password'' end end end Everytime I hit a ''login_required'' area of the site I get this error: undefined local variable or method `new_session'' for #<Admin::CategoriesController:0x18e93dc> I changed the new_session to new_session_url and it works fine but it redirects it to http://localhost:3000/sessions/new instead of http://localhost:3000/login. my routes look like this: map.with_options :controller => "sessions" do |page| page.login "/login", :action => "new" page.logout ''/logout'',:action => ''destroy'' end rake routes: new_session GET /session/new {:action=>"new", :controller=>"sessions"} Seems like it should work. Am I missing something? -- 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-/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 -~----------~----~----~----~------~----~------~--~---
I changed "new_session" to "login_path" in the following two instances. In authenticated_system.rb <pre><code> def access_denied respond_to do |format| format.html do store_location redirect_to login_path end format.xml do request_http_basic_authentication ''Web Password'' end end end </code></pre> In sessions_controller.rb <pre><code> def create self.current_user = User.authenticate(params[:login], params[:password]) if logged_in? if params[:remember_me] == "1" self.current_user.remember_me cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expires_at } end redirect_back_or_default(''/'') flash[:notice] = "Logged in successfully" else redirect_to login_path end end </code></pre> -- 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-/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 -~----------~----~----~----~------~----~------~--~---
Reasonably Related Threads
- Where can I get "authenticate_with_http_basic"?
- It seems to be a restful_authentication bug (was Re: Re: named route new_session not working)
- Re: Re stful_authentication, Internet Explorer, and unwanted http basic dialog
- step definitons to check login
- SHLG and lib dir