Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在 Helper,Models 和 Controller 里都用 def,它们的区别是什么? #81

Open
yzha3917 opened this issue Oct 24, 2016 · 1 comment

Comments

@yzha3917
Copy link

No description provided.

@liangchaob
Copy link

没有区别,def的意思是define的简写,『def a』 意思是说『定义一个名字为a的函数』

但是作用域不同,比如每个controller下每def一个函数,这个函数只针对该controller,不同之间的controller下的相同的def就类似于『三里屯梁朝伟和香港梁朝伟』

helper中所有def出来的目前实测发现貌似是全局都有效的,也就是在哪都能直接用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants