简体   繁体   English

在Rails视图中可以访问哪些变量?

[英]what variables are accessible in rails view?

In a rails view (be it erb or html or whatever), there are ruby variables accessible within the view. 在Rails视图中(无论是erb还是html或其他),视图中都可以访问ruby变量。 What defines the scope of the view? 什么定义了视图的范围? Is it whatever variables are within the scope of the controller's function being called? 是否在被调用的控制器功能范围内的任何变量?

无论是在控制器中声明的实例变量,还是可以通过before_filter在应用程序控制器中设置的任何实例变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM