Fork me on GitHub

rails2

    Love named_scope

    23 Jul 2010

    Wen-Tien Chang

    named_scope is awesome, it makes your codes much more readable, you can also combine named_scope finders to do complex finders. Read More

    Tags 


    Keep Finders on Their Own Model

    23 Jul 2010

    Wen-Tien Chang

    According to the decoupling principle, model should do finders by itself, a model should not know too much about associations finders logic. Read More

    Tags 


    Overuse route customizations

    22 Jul 2010

    Wen-Tien Chang

    According to Roy Fielding’s doctoral thesis, we should use restful routes to represent the resource and its state. Use the default 7 actions without overusing route customizations. Read More

    Tags 


    Not use default route if you use RESTful design

    22 Jul 2010

    Wen-Tien Chang

    If you use RESTful design, you should NOT use default route. It will cause a security problem. I explain at http://ihower.tw/blog/archives/3265 too. Read More

    Tags 


    Needless deep nesting

    22 Jul 2010

    Wen-Tien Chang

    Some people will define 3 or more level nested routes, it's a kind of over design and not recommended. Read More

    Tags 


    Move finder to named_scope

    14 Jul 2010

    Wen-Tien Chang

    Complex finders in controller make application hard to maintain. Move them into the model as named_scope can make the controller simple and the complex find logics are all in models. Read More

    Tags