Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 15491

Ruby-on-Rails-3-Rails 3: Before filtering the management problem of the session

$
0
0

I am working on an application that will ultimately help my company switch to the universal registration/activation process to help support many products. When new users register or activate (using the group code), the branding of the "single" system needs to be changed based on their origin.

Sekarang, saya mengatur tempat untuk meneruskan parameter client_id di URL dan kemudian @clientmengatur klien saat ini dengan melakukan ActiveRecord Find By.

Saya perlu mengaturnya agar informasi klien diatur dalam sesi. Tapi saya tidak bisa membuatnya berfungsi.

ini adalah milikkuApplicationController

class ApplicationController < ActionController::Baseprotect_from_forgerybefore_filter :set_client_idhelper_method :brand

def set_client_idsession[:client_id] ||= params[:client_id]end

def brand@brand = Client.find_by_app_id(session[:client_id])endendSalah satu masalah yang terus saya hadapi adalah jika seseorang kembali ke situs dengan client_idparameter berbeda, parameter lama tetap ada di sesi tersebut.

client_idclient_idBagaimana saya bisa menulis ulang di atas untuk selalu hanya mengatur apa yang ada di sesi, meskipun parameternya berubah?


Viewing all articles
Browse latest Browse all 15491

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>