Guest User

Untitled

a guest
Jul 15th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. # Filters added to this controller apply to all controllers in the application.
  2. # Likewise, all the methods added will be available for all controllers.
  3.  
  4. class ApplicationController < ActionController::Base
  5.  
  6. helper :all
  7. helper_method :set_menu_to, :back_path_or
  8.  
  9. before_filter :store_location
  10.  
  11. private
  12. def set_menu_to(menu)
  13. @menu = menu
  14. end
  15.  
  16. def store_location
  17. if request.request_method == :get && session[:last] != request.request_uri
  18. session[:back_path] = session[:last]
  19. session[:last] = request.request_uri
  20. end
  21. end
  22.  
  23. def back_path_or(default)
  24. session[:back_path] || default
  25. end
  26. end
Add Comment
Please, Sign In to add comment