15
I'm looking for people's examples of good* practices when using Rails.
I've got a couple such as:
before_filtercalls go underneath the controller class name declaration, nowhere else.- Base controllers for a namespace are named
BaseController, notApplicationController. There is, and should forever be, only oneApplicationController. attr_*methods are defined at the top of their respective classes.- Model callbacks go after
attr_*methods, or at the top of the model. - Validations go at the top of the model, with custom validation methods being defined as
privatemethods at the bottom of the file.
Now I'm not looking for Ruby's good practices, but more of a list of ones specifically in Rails. The ones listed above are just an example, not gospel.
* I didn't want to use the term "best practices", as best implies an ultimate, and in all things code people may disagree.