Created
July 7, 2009 19:33
-
-
Save tobias/142302 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#in controller | |
key = store_params(hash_of_params_to_keep) | |
redirect_to some_path(:params_key => key) | |
----------- | |
def store_params(hash_of_params) | |
key = Time.now.to_s + rand(10000).to_s #or some other unique key | |
session[:stored_params] ||= {} | |
session[:stored_params][key] = hash_of_params | |
key | |
end | |
-------------- | |
#in application_controller | |
before_filter :restore_params_by_key | |
def restore_params_by_key | |
params.merge!(session[:stored_params][params[:params_key]]) if session[:stored_params] and params[:params_key] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment