22 Oct 2014
Dan Kohn
The ActiveSupport method Time.zone.now should be used in place of the Ruby method Time.now to pickup the local time zone.
Read More
Tags
timezone
18 Sep 2013
David Davis
The params hash contains all the data that was submitted from a request. If you modify it, later code won't have access to it. Instead, copy the params hash and modify the copy.
Read More
Tags
controller
params
15 Jun 2013
Richard Huang
ActiveRecord provides default_scope to set a default scope for all operations on the model, it looks convenient at first, but will lead to some unexpected behaviors, we should avoid using it.
Read More
Tags
model
28 Mar 2013
Richard Huang
We always have multiple processes for rails websites, if any of them crashed, your website failed, so it would be better to monitor all of the processes and automatically restart crashed processes.
Read More
Tags
system administration
22 Mar 2013
Richard Huang
Recently we saw rails exposed some security issues, github was attacked, rubygems.org was crashed, they all remind us we must pay more attentions on our rails projects.
Read More
Tags
security
23 Nov 2012
Richard Huang
Rails is integrated with sprockets from 3.1, which gives you the power to pre-process, compress and minify your assets. It's awesome, but it slows down deployment a lot.
Read More
Tags
assets
deployment
02 Nov 2012
Richard Huang
The "save" method on ActiveRecord returns "false" and does nothing if the record is invalid. You should always check the return value, otherwise you may inadvertently not save the record. If you think the record can never be invalid, or don't want to check the return value, use "save!"
Read More
Tags
active_record
01 Nov 2012
Richard Bradley
In C# or Java, you can `catch (Exception)` to rescue all exception types. However, in Ruby you should almost never catch `Exception`, but only catch `StandardError`.
Read More
Tags
rescue
exception
29 Sep 2012
Zamith
Methods should focus on what you want done and not how you want it.
Read More
Tags
model
refactor
10 Sep 2012
Richard Huang
Your capistrano deploy.rb file might become complicated with the growth of your application, contain more and more cap tasks, it would be better to split these tasks into different files according to the functionalities, which makes it easy to maintain, and they are more likely to be reused in the future.
Read More
Tags
deployment
capistrano