18 October 2006 — The "Fat Controller" anti-pattern is shown and dissected, and the reader is taken through the process of refactoring it into a more readable, maintainable, and testable solution — 5-minute read When first getting started with Rails, it is tempting to shove lots of logic in the view. I’ll admit that I was guilty of writing more than one template like the following during my Rails
CakePHP だけではなくフレームワーク全般に当てはまることだと思います。 Fat models and how they change how you use the Model class – cakebaker 私もフレームワークを使い始めた当初はそうだったのですが、モデルに最初からあるメソッドだけを使用してコントローラでなんでもかんでもやってしまっていました。 そうではなく、もっとモデルにオリジナルのメソッドを追加して、コントローラではそれを使用した方がコントローラもすっきりして後から見たときにも何をしているか分かりやすいと思います。 例えばブログの最新エントリ10を find する場合コントローラに $this->Post->findAll(array('Post.is_published' => true), null, array('Post.published DESC'
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く