Fork me on GitHub

Active Record Query Interface Optimization

23 Jun 2011

Angelo Capilleri (capilleri@yahoo.com)

Use select with has_many and belongs_to on Active Record Associations Read More

Tags 


Create base controller

02 Jun 2011

Guo Lei (guolei9@gmail.com)

Have base controllers for DRY Read More

Tags 


Namespaced models

31 May 2011

Guo Lei (guolei9@gmail.com)

Make the app/models more clear using namespaced models Read More

Tags 


Keep code struture in models consistent

31 May 2011

Guo Lei (guolei9@gmail.com)

When the business logic of models becomes complex, it's very helpful to keep a consistent code structure that is agreed by team members. Read More

Tags 


split route namespaces into different files

04 May 2011

Richard Huang (flyerhzm@gmail.com)

the routes will become complicated with the growth of your application, contain different namespaces, each with a lot of resources and custom routes, it would be better to split routes into different files according to the namespaces, which makes it easy to maintain the complicated routes. Read More

Tags 


Remove empty helpers

09 Apr 2011

Richard Huang (flyerhzm@gmail.com)

If you use rails generator to create scaffolds or controllers, it will also create some helpers, most of the helpers are useless, just remove them. Read More

Tags 


Annotate your models

23 Jan 2011

Richard Huang (flyerhzm@gmail.com)

Are you tired of going to schema.rb to find your table structures information? It would be better to list all the attributes of the model in the model itself. Read More

Tags 


defer expensive job

12 Jan 2011

Richard Huang (flyerhzm@gmail.com)

If you want to process something expensive as part of a web request, it will delay the response. If the job is not critical, it's wiser to move the expensive to a background queue and returns the response immediately. Read More

Tags 


comment your magic codes

19 Dec 2010

Richard Huang (flyerhzm@gmail.com)

Ruby/Rails provides a lot of magic codes, especially for metaprogramming, they are powerful, less codes to implement more functions, but they are not intuition, you should write good comment for your magic codes. Read More

Tags 


Simplify render in controllers

12 Dec 2010

Richard Huang (flyerhzm@gmail.com)

Like the simplify render in views, from rails 2.3, we can also simplify render in controllers. Read More

Tags