Optimize for the happy path
Checking respond_to? incurs overhead, and most of the time when assigning attributes it will return true. So just handle the NoMethodError instead.
Showing
想要评论请 注册 或 登录
Checking respond_to? incurs overhead, and most of the time when assigning attributes it will return true. So just handle the NoMethodError instead.