Ruby 代码去哪儿?

chenge · 2014年05月27日 · 最后由 billy 回复于 2014年05月27日 · 1652 次阅读

各种代码应该写在什么位置,参考这个英文的:http://codefol.io/posts/Where-Do-I-Put-My-Code

文中提到一本电子书《Rebuilding Rails》,教你写框架,没人提过,有点意思。

Code in the application helper is included in all the views in your application. Code in other helpers is included in the corresponding view.

这段是错误的。

实际全都会包含吧。。。

楼主转载要关注时效性……

#4 楼 @Rei 过时了么,不会吧。基础的不会过时,那些花哨的 api 会过时。

的确过时了,现在是所有 view 可见。我上次还回了个帖子,现在找不到了 -- 话说回帖记录没有 pagination 真是不方便。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号