なるようになるブログ

読書感想文かrailsについてかrubyについてか

rails commit log流し読み(2014/09/05)

2014/09/05分のコミットです。

CHANGELOGにのったコミットは以下の通りです。

activesupport/CHANGELOG.md


Skip StatementCache for eager loaded associations (Fixes #16761)

ActiveRecordのassociation処理の修正です。

eager loadしたassociationについては、StatementCacheをスキップするよう修正しています。

以下のようなスコープを定義していた場合に、エラーが発生していたとの事です。

default_scope ->{includes([:state_course, :primary_subject_area, :district]).order('enabled desc, state_courses.name').references(:state_course) }

Remove example file

activemodel/examples/validations.rbを削除しています。

サンプルはrails guideに載せる方針とする為、こちらのファイルは削除との事です。


Document that method objects are not duplicable?

rails guideのActive Support Core Extensionsの修正です。

`duplicable?``メソッドについて、methodsもduplicate出来ない旨説明を修正しています。


Time#change throws exception with an out-of-range :usec

activesupport/lib/active_support/core_ext/time/calculations.rbの修正です。

Time#changeメソッドのusecに不正な値を指定した場合に、ArgumentErrorを起こすよう修正しています。

Time.new(2005, 2, 22, 15, 15, 45, "-08:00").change(:usec => 1000000)
#=> ArgumentError: argument out of range

Change "For not..." to "Do not...".

railties/lib/rails/generators/rails/app/templates/config/application.rbのdocの修正です。

For->Doに修正しています。


:scissors: and from #16803 [ci skip]

rails guideのActive Support Core Extensionsの修正です。

説明上不要な"and"を削除しています。


always reorder bind parameters. fixes #15920

activerecord/lib/active_record/relation/query_methods.rbの修正です。

build_arelメソッドです、bindするパラメータを必ず並び替えしなすよう修正しています。


Load :developers fixtures where expecting a Developer to be there

activerecord/test/cases/relation/merging_test.rbの修正です。

loadするfixturesにdevelopersを追加しています。


Merge pull request #16699 from cristianbica/aj-refactor-queueing

ActiveJobのリファクタリングです。

コア部分をclassに切り出し、メソッド名の修正、パラメータ名の修正等を行っています。

deliver_later!/deliver_laterメソッドの引数名もさらっと変わってたりします。

# before
Notifier.welcome(User.first).deliver_later!(in: 1.hour)
Notifier.welcome(User.first).deliver_later!(at: 10.hours.from_now)

# after
Notifier.welcome(User.first).deliver_later!(wait: 1.hour)
Notifier.welcome(User.first).deliver_later!(wait_until: 10.hours.from_now)

また、ActiveJobのメソッド名も変更になっています。

# before
HelloJob.enqueue('david')

# after
HelloJob.perform_later('david')

betaとはいえ、一度出した後に割と大幅に変更が入りましたねえ。


Move variable assignment within logging block.

activejob/lib/active_job/logging.rbの修正です。

ログ出力処理をブロックの中に移動しています。


cover all cases of For not --> Do not, related to #16804

activerecord/CHANGELOG.mdの修正です。

For not->Do notに説明を修正しています。


correct rdoc [ci skip]

activejob/lib/active_job/test_helper.rbのdocの修正です。

先に行われたActiveJobの対応に合わせて、docの修正を行っています。


Fixed regression with referencing polymorphic assoc in eager-load

ActiveRecordのassociationに関する修正です。

polymorphic associationを使用していた場合に、エラーが発生するリグレッションがあったのを修正しています。

以下のようなケースで問題が起きていたようです。

class Post < ActiveRecord::Base
  has_many :comments
  has_many :notes, as: :notable
end

class Note < ActiveRecord::Base
  belongs_to :notable, polymorphic: true
end

class Comment < ActiveRecord::Base
  belongs_to :post
end

Post.includes(:comments).order("comments.category").first
Post.includes(:notes).order("notes.category").first

Freeze ADAPTER_NAME in adapters

ActiveRecordの各adapaterの修正です。

adapter名をfreezeするよう修正しています。値変更出来なくようにする為ですね。


For now, we will keep sorting the tests.

各ライブラリのRakefileの修正です。

テストを実行する際、各テストファイルをsortするよう修正しています。

元々sortは実施しており、このコミットでsort削除したのですが、まだsortは無いとまずい、という事で戻したようです。


world writable might be a bit too open...

railties/lib/rails/application/bootstrap.rbの修正です。

ログファイルにアクセス出来なかった場合のエラーメッセージを少し修正しています。

-            "Rails Error: Unable to access log file. Please ensure that #{path} exists and is chmod 0666. " +
+            "Rails Error: Unable to access log file. Please ensure that #{path} exists and is writable " +
+            "(ie, make it writable for user and group: chmod 0664 #{path}). " +