I'm looking for people's examples of good* practices when using Rails.

I've got a couple such as:

  • before_filter calls go underneath the controller class name declaration, nowhere else.
  • Base controllers for a namespace are named BaseController, not ApplicationController. There is, and should forever be, only one ApplicationController.
  • 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 private methods 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.

Edit
Report