开发者

Rails 3: Where to store shared methods for models?

开发者 https://www.devze.com 2023-02-21 12:11 出处:网络
I have a method \"random_password\" that I\'d like to be able to access from multiple models in my rails 3 project. I\'m just wondering what the convention is for where to store it & how to provid

I have a method "random_password" that I'd like to be able to access from multiple models in my rails 3 project. I'm just wondering what the convention is for where to store it & how to provide access 开发者_Go百科to it. Any help appreciated.


You would need a module. This is shared and can be used by multiple models. They are typically placed in /lib.

0

精彩评论

暂无评论...
验证码 换一张
取 消