Ruby 代码去哪儿?

chenge · May 27, 2014 · Last by billy replied at May 27, 2014 · 1653 hits

各种代码应该写在什么位置,参考这个英文的: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.

这段是错误的。

#1 楼 @fredwu 怎么错了。。

实际全都会包含吧。。。

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

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

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

You need to Sign in before reply, if you don't have an account, please Sign up first.