search for: return_to

Displaying 20 results from an estimated 39 matches for "return_to".

2006 May 10
2
session[:return_to] for going back.
Hi, Is session[:return_to] something Rails maintains to quickly go back to the previous uri without having to keep track of the action name? Or, do we have to actually set it in our actions? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails...
2013 Jan 18
1
redirect_to(session[:return_to]) vs session.delete
Hey all, Recently I''ve been looking into on how to return back to a previous referring URL and and the most common approach is: redirect_to session[:return_to] But some recommend: redirect_to(session.delete(:return_to) || default) How I understand it, in the second example we call session.delete so it will clear the return path since we will no longer need it, and we also use || to fall back to default URL in case the session is nil. Kind of mak...
2006 Jun 28
2
Saving and reproducing a POST request.
Hi I have an action which saves the originating resource from which it was called, and returns to it later. This is done by setting: session[:return_to] = request.referer ... redirect_to(session[:return_to]) Which works great for GET resources. The problem is that POST variables aren''t kept in request.referer, so this method fails when the originating resource is a a POST. What''s a good way do the above for POST resources? --...
2006 May 08
4
link_to - Going Back without knowing the action name.
Hi, I have a bunch of link_to''s in my code that are simple Back buttons that should basically just go to the previous request. Is there a way of doing this without specifying the action to execute? The problem is, sometimes I may render the same view through separate actions so I wouldn''t know which action to go back to. Thanks. -------------- next part -------------- An HTML
2008 Sep 11
4
(unknown)
I do not seem to understad what this error is about. Some body help. wrong number of arguments (1 for 2) RAILS_ROOT: C:/INSTAN~1/rails_apps/project/config/.. Application Trace | Framework Trace | Full Trace #{RAILS_ROOT}/app/controllers/user_controller.rb:10:in `authenticate'' #{RAILS_ROOT}/app/controllers/user_controller.rb:10:in `process_login''
2006 Feb 28
1
Oracle OraNumber problem with Authentication. Please help!
...tion.rb. This is the code : class LoginController < ApplicationController model :employee ..... def authenticate if employee = Employee.authenticate(@params["username"], @params["password"]) session["employee"] = employee if session["return_to"] redirect_to_path(@session["return_to"]) session["return_to"] = nil else redirect_to :controller => "weblog" end else flash["alert"] = "Login failed!" redirect_to :action => "index...
2005 Nov 25
0
Login Authentication working in IE but not in Mozilla
...iven in the following 3 steps: 1)The controller that needs protection: class WeblogController < ActionController::Base before_filter :authenticate def index # show the secret stuff end protected def authenticate unless @session["person"] @session["return_to"] = @request.request_uri redirect_to :controller => "login" return false end end end 2)The controller that does login: class LoginController < ActionController::Base def index # show login screen end def authenticate if @session["...
2008 Jan 30
2
Where can I get "authenticate_with_http_basic"?
...format.xml do request_http_basic_authentication ''Web Password'' end end end # Store the URI of the current request in the session. # # We can return to this location by calling #redirect_back_or_default. def store_location session[:return_to] = request.request_uri end # Redirect to the URI stored by the most recent store_location call or # to the passed default. def redirect_back_or_default(default) redirect_to(session[:return_to] || default) session[:return_to] = nil end # Inclusion hook to make #...
2004 Oct 24
0
redirection bug ?
Hi I use code from authentication example from ruby on rails web page. Everything looked fine until i found thet when i log for the first time it gives me bad redirection. When session[''return_to''] was set everythig had been fine so i changed (look into my code) from 1 to 2. this is from login controler def login if Admins.authenticate(@params["username"], @params["password"])!= nil then @session[''logged_in''] = true...
2006 Dec 27
5
redirect back to where I was before action?
For some reason I cannot find the documentation for this. How can I store the current URI/URL so that I can return with a redirect_to? session[last_action] = ??? -- 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,
2006 May 03
0
Accessing the params hash in a functional test not working
I am having problems reading params in a functional test (Rails 1.1.2). My test looks like this: fixtures :users def test_auth_bob @request.session[:return_to] = "/bogus/location" post :login, :user => { :email => "bob@example.com", :password => "test" } assert_session_has :user assert_equal @bob, @response.session[:user] assert_redirected_to "/bogus/location" end And the login action l...
2007 Jun 29
0
acts_as_authenticated, reset_session, and redirect_back_or_default
...an FYI I just installed rails and acts_as_authenticated and was setting up a site. Everything works fine except that in the AccountController that I generated the calls to the routine redirect_back_or_default don''t work because the call just before it to reset_session clears the session[:return_to] that the method uses to set where it will redirect. I ended up adding a version of redirect_back_or_default to the account controller that works for me (and as a benefit it keeps me from having to set session[:return_to] which stunk) def redirect_back_or_default(default) if request.env["...
2010 Feb 19
0
You are being redirected
...t;</html> I do not know why this is happening or what I did to trigger this behaviour. The API does not give me any clues as to what is going on. The redirect command involved is: redirect_back_or_default(welcome_path) def redirect_back_or_default(default) redirect_to(session[:return_to] || default) session[:return_to] = nil end Up to today this has simply displayed the target page. I have no idea how or why the intermediate redirect page is generated. I would be very grateful if anyone can enlighten me on this matter. -- You received this message because you are su...
2006 Nov 08
1
controller.session not same as session?
...breakpoint in and examining the two reveals: > > >> session > => #<ActionController::TestSession:0x3a8e794 @attributes={:user=>1, > "flash"=>{}}> > >> controller.session > => #<ActionController::TestSession:0x3a797e0 @attributes= > {:return_to=>nil, "flash"=>{:notice=>"You have been logged out."}}> > >> > > Am I doing something wrong? The spec names say "session" and "controller.session", but both are coded to go after "controller.session". Since each spec get...
2018 Feb 11
4
Parallel assignments and goto
...t;- function (n, acc = 1) { .tailr_env <- rlang::get_env() .tailr_frame <- rlang::current_frame() repeat { if (n <= 1) rlang::return_from(.tailr_frame, acc) else { rlang::env_bind(.tailr_env, n = n - 1, acc = acc * n) rlang::return_to(.tailr_frame) } } } Here, again, for the factorial function since this is easier to follow than the list-length function. This solution will also work if you return values from inside loops, where `next` wouldn?t work either. Using `rlang::return_from` and `rlang::return_to` implemen...
2018 Feb 11
0
Parallel assignments and goto
...; .tailr_env <- rlang::get_env() > .tailr_frame <- rlang::current_frame() > repeat { > if (n <= 1) > rlang::return_from(.tailr_frame, acc) > else { > rlang::env_bind(.tailr_env, n = n - 1, acc = acc * n) > rlang::return_to(.tailr_frame) > } > } > } > > Here, again, for the factorial function since this is easier to follow than the list-length function. > > This solution will also work if you return values from inside loops, where `next` wouldn?t work either. > > Using `rlang::r...
2010 May 27
3
before_filter always running in test, not in development or production mode.
...site on GET to :show should respond with success. (UsersControllerTest) []: Expected response to be a 200, but was 302 Here is the code for my before_filter that is actually making this test fail: def login_required authorized? || access_denied end def access_denied session[:return_to] = request.fullpath flash[:error] = t(''application.flash.error.login_required'') redirect_to(new_sessions_path) end This code, as far as my understanding goes, should NOT ever be called from this test though... I have the :only => [] in the controller to not do it on...
2006 Apr 22
5
ActiveRBAC 0.3.1 Released
...our own code easier. (#112) * Moving the constants User::DEFAULT_PASSWORD_HASH_TYPES and User::DEFAULT_STATES to private class methods with lowercased names. (CHECK FOR DEPENDENCY IN YOUR CODE) * Renaming the "redirect_to" parameter/session variable nam of LoginController to "return_to" (#103) * Adding "all_static_permissions" method to User. (#109) * Adding Version identifier as described in http://api.rails- engines.org/engines/classes/Engine.html (#104) * Removing 3 lines from user_controller.rb that expected InvalidStateTransition to be thrown (#113) * addin...
2007 May 23
3
User Login (process_login)
...following code in my UsersController: def login @user = User.new @user.username = params[:username] end def process_login if user = User.authenticate(params[:user]) session[:id] = user.id # Remember the user''s id during this session redirect_to session[:return_to] || ''/'' else flash[:error] = ''Invalid login.'' redirect_to :action => ''login'', :username => params[:user][:username] end end def logout reset_session flash[:message] = ''You are now logged out....
2008 Jun 13
3
before_filter order of execution
...------------------ IN USER_CONTROLLER before_filter :login_required before_filter :access_granted, :only => [:destroy, :new , :edit] IN APPLICATION.RB def logged_in? ! @current_user.blank? end helper_method :logged_in? def login_required return true if logged_in? session[:return_to] = request.request_uri redirect_to :controller => "/account", :action => "login" and return false end def access_granted if @current_user.blank? return false else return (@current_user.access_level == 2) end end helper_method :access_gra...