26 Jul 2010
Ng Tze Yang
Using declaratives (eg. acts_as_authentic) provided by external libs is unavoidable in building a rails application. But testing 3rd party libs is surely not part of our work, yet how do we rest assured that these declaratives are called ??
Read More
Tags
rspec
26 Jul 2010
Ng Tze Yang
Macro-writing is a great way to keep ur specs beautiful, compact & readable, & keeps specs writing fun. Macro-writing isn't rocket science, everyone can do it (almost, i think).
Read More
Tags
rspec
26 Jul 2010
Jaime Iniesta
When you generate a new migration, try it forwards and backwards to ensure it has no errors
Read More
Tags
migration
25 Jul 2010
Gregory Durelle
Using the cache will speed up your application response time a lot. In fact, when people will request your pages, rails won't be requested, apache will serve the cached pages, thus double advantage, faster pages response time Lower charge on your server
Read More
Tags
cache
25 Jul 2010
Wen-Tien Chang
N+1 Queries is a serious database performance problem. Be careful of that situation! If you're not sure, I recommend you install http://github.com/flyerhzm/bullet plugin, which helps you reduce the number of queries with alerts (and growl).
Read More
Tags
model
plugin
24 Jul 2010
Wen-Tien Chang
Observer serves as a connection point between models and some other subsystem whose functionality is used by some of other classes, such as email notification. It is loose coupling in contract with model callback.
Read More
Tags
model
observer
24 Jul 2010
Wen-Tien Chang
Don't repeat yourself in controller, use before_filter to avoid duplicated codes.
Read More
Tags
controller
24 Jul 2010
Wen-Tien Chang
According to the law of demeter, a model should only talk to its immediate association, don't talk to the association's association and association's property, it is a case of loose coupling.
Read More
Tags
model
24 Jul 2010
Wen-Tien Chang
In partial view, we can use the instance variable directly, but it may be confused and make it hard to reuse anywhere, because we don't know exactly which instance variable can be used, so use the local variable in partial with explicitly assignment.
Read More
Tags
view
24 Jul 2010
Wen-Tien Chang
According to MVC architecture, there should not be logic codes in view, in this practice, I will introduce you to move codes into model.
Read More
Tags
model
view