[英]Check current page from controller in Rails?
Is there a way to check the current page from the controller? 有没有办法从控制器检查当前页面? I tried
我试过了
current_page?
but that returns an error : 但是会返回错误:
undefined method 'current_page?'
In the controller action and view the following helpers are available: 在控制器操作和视图中,可以使用以下帮助程序:
controller_name
action_name
You can guess from its' names, what each does. 你可以从它的名字中猜出每个人的名字。
try to check like this in view 尝试在视图中检查这样
logger.info("--------#{params[:controller]}-------------")
logger.info("--------#{params[:action]}-------------")
see in log of terminal 在终端的日志中看到
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.