Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Redirect from custom action to Rails app doesn't work half the time #1219

Closed
reedlaw opened this Issue · 1 comment

2 participants

@reedlaw

I have this custom action:

member :login_as do
  link_icon 'icon-user'
  i18n_key :login_as
  visible do
    bindings[:abstract_model].model.to_s == "User"
  end
  controller do
    Proc.new do 
      if can? :manage, User
        session[:user_id] = params[:id]
        redirect_to Settings.host_url
      end
    end
  end
end

When I click the custom action link I sometimes get a blank page. I have to manually enter the app root url in order to continue. There are no error messages. Other times I get redirected automatically. Not sure if this is a strange app issue or if anyone else has this problem.

@mshibuya
Collaborator

I used to have similar issue.
I've not made a deep investigation, but ActiveRecord session store seemed to have difficulty with flushing of session data on redirection.
As a workaround, I did something like:

      if can? :manage, User
        cookie[:user_id] = params[:id]
        redirect_to Settings.host_url
      end

and picked up the content of cookie after redirection.

Anyway, this does not appears to be an issue with RailsAdmin.

@mshibuya mshibuya closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.