I am working on improving a project where currently we have a user status
parameter stored in session. However, I would like to move status
out of the session, as I don't want this status
to be affected by different tabs from the same users. So my proposal is like I need to add the status
to the end of the URL like
htttp://example.com/index/?status=0
I already have a before_action for the application controller to read status
like below
def set_status
if params[:status]
@status = params[:status]
else
@status = 0
end
end
Previously, when I stored the status in the session, the before action was more like below
def set_status
if session[:status].nil?
session[:status] = 0
end
@status = session[:status]
end
But I don't know what to do to add /?status=0
for all URLs I have in the project and keep it unchanged from one page to another unless the user changes it. As it is a very large and complicated project, I don't think I can go to every view or controller action to manually add it one by one. So I am wondering if there is an elegant solution to it.
Aucun commentaire:
Enregistrer un commentaire