I need to redirect from within an action called by an Ajax request
def create
…
respond_with resource do |format|
format.js {
… # test on user locale and changed
I18n.default_locale =
resource.current_membership.account_type.locale.code.to_sym
I18n.locale = I18n.default_locale
session[:return_to][“locale”] = I18n.locale.to_s
@url = session[:return_to] || root_path
session[:return_to] = nil
render :action => “signed_in.js”
}
=============
what should I write in my signed_in.js to redirect to @url ??
I wrote
$(location).attr(‘href’,"<%= @url %>");
but it doesn’t seems to tale in account the new locale
debugger : @url
{“utf8”=>“✓”, “authenticity_token”=>“EduXy97cc1YvHGRTqVfgCLT3HKfYfRwxF/
VM7yC4+j4=”, “user”=>{“login”=>“[email protected]”,
“password”=>"[FILTERED]"}, “commit”=>“SIGN IN”, “action”=>“create”,
“controller”=>“users/sessions”, “locale”=>“es_ES”}
which is the session[:return_to]