The indentation is 2 spaces, for all the following languages.
Avoid using return in methods.
Access instance's methods using
instead of just
make clear that an instance thing, not a variable, is being used.
Also, for setters, some times ommitting the
will lead to a bug as it will create a variable instead of calling the instance method.
When a method has arguments, always use parenthesis in its declaration
- relationships (
belongs_to, etc) and applied behaviour (
- virtual attributes, if needed
- business logic in general
Thin controllers, fat models
- every time you write a method with more than, say, 5 lines in a controller, consider if some of its logic shouldn't go inside a model class
- NEVER reference anything but assigned
@variables inside templates (
- test every validation that you add to ActiveRecord models
- add a test to your unit tests that passes all your fixtures through ActiveRecord validation, unless you are using an individual fixture as invalid data on purpose. Name your invalid data fixtures with "invalid_" as prefix.
- every model must have unit tests
- every controller must have functional tests. At least one test for each action.
- every user story must have one or more corresponding integration tests.
- Rcov reports must present 100% coverage of everything