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::Base
protect_from_forgery
before_filter :set_client_id
helper_method :brand
def set_client_id
session[:client_id] ||= params[:client_id]
end
def brand
@brand = Client.find_by_app_id(session[:client_id])
end
end
Salah 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?
Zambia Wariman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.