2015/05/26分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- deprecate
Relation#uniquseRelation#distinctinstead. - add
extendoption onhas_and_belongs_to_many.
Fixed the grammatical mistake in the sentence [ci skip]
rails guideのContributing to Ruby on Railsの修正です。
What about Feature Requests?の項のグラマーの修正を行っています。
Use memoization while accessing request headers for minimizing memory usage
actionpack/lib/action_dispatch/http/request.rbの修正です。
headersメソッドで、メソッド内で作成したHttp::Headersクラスの情報をメモ化するよう修正しています。
Merge pull request #16938 from akshay-vishnoi/remove-deprication
ActiveSupportの修正です。
deprecateになっていたClass#superclass_delegating_accessorを削除しています。今後はClass#class_attributeを使用して下さい、との事です。
Remove redundant 'like' from doc of slice! method [ci skip]
activesupport/lib/active_support/multibyte/chars.rbのdocの修正です。
slice!メソッドのdoc内に不要なlikeがあったのを修正しています。
deprecate Relation#uniq use Relation#distinct instead.
ActiveRecordの修正です。
Relation#uniqメソッドがdeprecateになりました。今後はRelation#distinctメソッドの方だけを使用するように、との事です。
元々Relation#uniqメソッドをRelation#distinctに 名前を変更しよう という提案があったのですが、当時は互換性等の事を考慮して、Relation#distinctメソッドを追加、に留めたようのですが、Railsのバージョンも挙がったので、改めて削除の方で動いたようです。因みにArray#uniqとRelation#uniqが似ており、混乱しやすい為、というのが理由のようです。
activerecord/test/cases/relation/mutation_test.rbの修正です。
uniq!メソッドを使用した際にdeprecateメッセージが表示される事を確認するテストから、使用していない変数を削除しています。
add extend option on has_and_belongs_to_many.
activerecord/lib/active_record/associations.rbの修正です。
has_and_belongs_to_many associationsに:extendオプションを渡せるよう修正しています。
:extendオプションは、association objectに追加したいmodule等を指定する為のオプションで、has_many association等には以前から指定可能だったのですが、has_and_belongs_to_manyでは使えなかったんですねえ。
例。
class DeveloperWithExtendOption < Developer module NamedExtension def category 'sns' end end has_and_belongs_to_many :projects, extend: NamedExtension end eponine = DeveloperWithExtendOption.create(name: 'Eponine') eponine.projects.category => 'sns'
Add info on default layout functionality 3.2 >> 4.0 upgrade
rails guideのA Guide for Upgrading Ruby on Railsの修正です。
3.2 -> 4.0での変更点の一覧に、指定したレイアウトファイルが見つからなかった時のlayoutメソッドの戻り値の変更について追記しています。