开发者

Rails 3: Where to store shared methods for models?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜