SORU
28 Mart 2011, PAZARTESİ


Raylar 3: Nasıl &Ajax çağrısı;redirect_to""?

attempt_login aşağıdaki yöntemi bir giriş formu teslim ettikten sonra Ajax kullanarak denir.

class AccessController < ApplicationController
  [...]
  def attempt_login
    authorized_user = User.authenticate(params[:username], params[:password])

    if authorized_user
      session[:user_id] = authorized_user.id
      session[:username] = authorized_user.username
      flash[:notice] = "Hello #{authorized_user.name}."
      redirect_to(:controller => 'jobs', :action => 'index')
    else
      [...]
    end
  end
end

Sorun redirect_to çalışmıyor.

Bunu nasıl çözersin ?

CEVAP
29 Mart 2011, Salı


Son olarak, ben sadece yerini aldı

redirect_to(:controller => 'jobs', :action => 'index')

bu:

render :js => "window.location = '/jobs/index'"

ve gayet iyi çalışıyor!

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • aki6336

    aki6336

    14 AĞUSTOS 2008
  • ASUS North America

    ASUS North A

    12 AĞUSTOS 2008
  • cekehechu

    cekehechu

    20 HAZİRAN 2006