I've created a class that I want to make available to the entire project for error responses. Where would I put it in the RoR 3.1 directory structure? In the lib/assets? Also, is there information somewhere online for this? I did a few searches and couldn't find anything.
Thanks!
Non-model related code, I normally put in /lib
.
If that gets busy, I'll probably create subdirectories of /lib
eg.
/lib/reports
/lib/utils
/lib/validators
(this could probably live in /models/validators
too) But more likely, I'll end up building a gem to handle the functionality.
This is kind of a question about working practices, so doesn't get documented so much, but I'd encourage you to take a look at The Rails 3 Way
, quite a hefty book, full of tutorials, and advice on good coding style.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.