Fork me on GitHub

Namespaced models

31 May 2011

Guo Lei

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

Tags 


Keep code struture in models consistent

31 May 2011

Guo Lei

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

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

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

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

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

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

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

Tags 


Simplify render in views

04 Dec 2010

Richard Huang

render is one of the often used view helpers, we can pass object, collection or local variables. From rails 2.3, more simplified syntax for render are provided. Read More

Tags 


remove trailing whitespace

02 Dec 2010

Richard Huang

Trailing whitespace always makes noises in version control system, it is meaningless. We should remove trailing whitespace to avoid annoying other team members. Read More

Tags