Skip to content

Commit

Permalink
Rules about controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
Tsvetomila Mihaylova committed Oct 21, 2011
1 parent 5a4d3fd commit a7c23c4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,13 @@ some configurations need to be applied in the `config/initializers/carrierwave.r
* Keep the controllers skinny - they should only retrieve data for the
view layer and shouldn't contain any business logic (all the
business logic should naturally reside in the model).
* Each controller action should call only one method other than an initial find or new.
* Share no more than two instance variables between a controller and a view.
## Models
* Introduce non-ActiveRecord model classes freely.
* Name the models with meaningful but short names without abbreviations.
### ActiveRecord
Expand Down Expand Up @@ -188,11 +191,11 @@ create a custom validator file.
end
```

* All custom validators should be moved to a shared gem.
* Use named scopes freely.
* When a named scope with lambda and parameters becomes too complicated it is better to make a class method instead which
serves the same purpose of the named scope and returns and `ActiveRecord::Relation` object.


## Migrations

* Keep the schema.rb under version control.
Expand Down

0 comments on commit a7c23c4

Please sign in to comment.