Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有一种简单的方法可以做到这一点?无论用户尝试访问哪个页面,我如何始终触发此控制器?
您可以添加before_filter到ApplicationController:
before_filter
ApplicationController
before_filter :login_required protected def login_required redirect_to root_url if not logged_in? end