2014/10/13分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
activerecord/CHANGELOG.md
Default generated Gemfile to coffee-rails ~> 4.1.0
Gemfile
、railties/lib/rails/generators/app_base.rb
の修正です。
coffee-rails
のバージョンを4.1.0にアップデートしています。
因みに、拡張子が、js.coffee
からcoffee
から変更になっているようです。
Replace Enumerable#reverse.each with Enumerable#reverse_each
Enumerable#reverse.each
を使用していた箇所をEnumerable#reverse_each
に修正しています。
Enumerable#reverse
はArrayの生成処理を行う為、Enumerable#reverse_each
の方が17%位早くなるとの事です。
PRに記載されていた性能測定結果は以下の通りです。
require 'benchmark/ips' ARRAY = (1..100).to_a def slow ARRAY.reverse.each{|x| x} end def fast ARRAY.reverse_each{|x| x} end Benchmark.ips do |x| x.report('slow') { slow } x.report('fast') { fast } end
# Ruby 2.1.2 slow 156173.2 (±9.2%) i/s - 770040 in 5.009112s fast 182859.3 (±7.8%) i/s - 914486 in 5.035575s
Replace Array#shuffle.first with Array#sample
Array#shuffle.first
を使用していた箇所をArray#sample
に修正しています。
こちらも先のEnumerable#reverse_each
の修正同様、性能改善の為です。
PRに記載されていた性能測定結果は以下の通りです。
require 'benchmark/ips' ARRAY = (1..100).to_a def slow ARRAY.shuffle.first end def fast ARRAY.sample end Benchmark.ips do |x| x.report('slow') { slow } x.report('fast') { fast } end
# Ruby 2.1.2 slow 324806.7 (±8.1%) i/s - 1620738 in 5.028042s fast 5069719.9 (±9.5%) i/s - 24872400 in 5.011482s
これは大分差が出ますねえ。
Start running railties builds first, since they take the longest finish
.travis.yml
の修正です。
railtiesのbuildsが最初に行われるよう、.travis.yml
の処理の順番を修正しています。
railtiesが一番テストに時間が掛かっている為との事です。
Merge pull request #17234 from arthurnn/add_regression_for_path_and_cascade
actionpack/test/controller/integration_test.rb
の修正です。
routerがPATH_INFO
を上書きしてしまうバグがあったららしく、その確認の為のテストを追加しています。
fix test_helper for mountable plugin
railties/lib/rails/generators/rails/plugin/templates/test/test_helper.rb
の修正です。
ActiveRecord::Migrator.migrations_paths
にPLUGIN_ROOT/db/migrate
を追加しています。
rails engineを作成する際、test_helperがtest/dummy/db/migrate
しか参照しておらず、大元のdb/migrate
を参照してなかった為、pending中のmigrationを見つける事が出来なかった為、対応したようです。
tools/profile
を削除しています。
もう使用してない為、削除したとの事だったのですが、実はまだ使っているらしく、後でrevertしています。
Merge pull request #17230 from robertoz-01/master
activesupport/lib/active_support/core_ext/file/atomic.rb
の修正です。
atomic_write
メソッドで、Errno::EACCES
もrescueするよう修正しています。ファイルパーミッションの変更の際に、EACCESが発生する可能性がある為との事です。
atomic_write
の存在自体初めて知りました。
Revert "Merge pull request #17247 from igas/fix-deprecations"
tool/profile
の削除をrevertしています。
Document the propose of tools/profile
tools/profile
のdocの修正です。
tools/profile
についての説明を追加しています。
Do not use deprecated exists?
method
tools/profile
の修正です。
exists?
を使用していたのをexist?
に修正しています。
Make a note about the internal tools/ dir and what each utility does
tools/README.md
を新規に作成しています。
各toolについての説明を記載しています。
line_statistics is not an executable
tools/README.md
の修正です。
先に追加されたtools/README.md
で、line_statistics
が実行可能という説明になっていたのですが、実際は違うらしく説明を修正しています。
Autosave callbacks shouldn't be after_save
activerecord/lib/active_record/autosave_association.rb
の修正です。
add_autosave_association_callbacks
メソッドで、after_save
メソッドを使用していたのを、after_create
、after_update
を使用するよう修正しています。
class Post < ActiveRecord::Base has_many :comments after_create :set_first_comment_id private def set_first_comment_id update_attribute(:first_comment_id, self.comments.first.id) end end
p = Post.new(:title => 'test') p.comments.build(:content => 'test2') p.save
上記のようなコードの場合に、after_create
でcommentsの値が取得出来ないバグがあり、その対応を行っています。
因みに、rails 4.2で入ったバグなので、それより前のバージョンには影響無いようです。