u16suzuの blog

日々学んだことのメモブログです。

2013-04-24から1日間の記事一覧

read_attribute and write_attribute can use both symbol and string as arguments.

In ruby on rails read_attribute and write_attribute can use both symbol and string as arguments.If you use attributes method you can use only string as argument.via: http://blog.eiel.info/blog/2012/12/17/read-attribute-activerecord/

Ruby useful methods; Object#try and Object#presence

Object#try user ? user.name : 'no user'it can be convert to user.try(:name) || 'no user'Object#presence name = params[:name] ? params[:name] : 'no name'it can be convert to name = params[:name].presence || 'no name'

amazon ELB distribute traffic via instance's availability zone.

amazon ELB distribute traffic via instance's availability zone.The message is shown at AWS. Note: You do not have an equal number of instances in each availability zone. We recommend having the same number of instances in each availability…