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.
我正在做一个带有会话管理的应用程序,我想在每个页面的顶部显示用户是否登录。我在 application.rhtml.erb 中有这个前端,是否有任何控制器/方法可以让我设置站点范围的变量?因为我为每个单独的页面定义了条件,所以必须有更好的方法。
将您的方法放入application_helper.rb文件中。这将在整个站点范围内可用。
application_helper.rb