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.
精彩评论