Avoid to_sym calls
Don't call after_commit when creating through an association and save fails, fixes #5802
Merge pull request #9115 from bensie/issue_5802

Don't call after_commit when creating through an association and save fails, fixes #5802
9253: Before writing a numeric attribute value, ActiveRecord does an implicit
conversion of boolean types (true => 1 and false => 0). If the numeric value
being assigned is a BigDecimal, then ActiveRecord compares a BigDecimal to
true and false. This is known to be very slow in Ruby 1.9.3.
Merge pull request #9254 from warnickr/9253_avoid_bigdecimal_performance_issue

Before writing a numeric attribute value, ActiveRecord does an implicit conversion of boolean types (true => 1 and false => 0). If the numeric value being assigned is a BigDecimal, then ActiveRecord compares a BigDecimal to true and false.

This is known to be very slow in Ruby 1.9.3 (see http://www.ruby-forum.com/topic/4409452 and https://bugs.ruby-lang.org/issues/7645#change-35188).

The Ruby core team has implemented a fix for this issue that will be included in Ruby 2, but they appear to have no intention of back-porting this fix to Ruby 1.9.3. In my case, the performance impact of this issue was enormous (200% - 300% performance hit) for some of the pages in my application.

See c75b5a88a82c79fdf95dfea4d72bf3c5a829930e applied to 3-2-stable branch for more reasoning and a benchmark.