なるようになるブログ

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

rails commit log流し読み(2014/12/24)

2014/12/24分のコミットです。

CHANGELOGへの追加はありませんでした。


Refactor a common class to reduce the duplication for references

activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rbactiverecord/lib/active_record/connection_adapters/abstract/schema_statements.rbの修正です。

TableDefinition#referencesメソッドSchemaStatements#add_referenceメソッドは殆ど似たような処理になってしまっていたので、 メソッドから共通した処理を切り出して新規クラス(ReferenceDefinition)を作成し、共通部分についてはそのクラスを使用するよう修正しています。


Rails::Application#secrets should be documented.

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

Application#secretsメソッドのrdocを追加しています。


Don't treat nil as changed in serialized types

activerecord/lib/active_record/type/serialized.rbの修正です。

serializeを使用しているカラムにnilを設定した場合に、changedの判定処理に誤りがあったのを修正しています。

issueより。

class Post < ActiveRecord::Base
  serialize :categories, Array
end

post = Post.create!(categories: nil)
post.categories # => [] in 4.2.0 and 4.1.8
post.categories_changed? # => true in 4.2.0, false in 4.1.8

# reloading the object in the future will have the same results
post2 = Post.find(post.id)
post2.categories # => [] in 4.2.0 and 4.1.8
post2.categories_changed? # => true in 4.2.0, false in 4.1.8

Remove unneeded special case to calculate size for has_many :through

activerecord/lib/active_record/associations/has_many_through_association.rbの修正です。

sizeメソッドを削除しています。

元々はhas_many :throughの場合のみ特殊で、独自にメソッドを定義していたようなすが、 現在は親クラスであるCollectionAssociation#sizeで処理が行われる為、不要である為削除したようです。


proof of concept, need to check in GitHub

guides/rails_guides/markdown/renderer.rbguides/source/2_2_release_notes.mdの修正です。

guideの中に'GITHUB-WARNING'という文字列があった場合、その文字列を除去するテスト(コミットログがproof of conceptとなっている) を行っているようです。


second test to warn against reading guides in GitHub

guides/rails_guides/markdown/renderer.rbguides/source/2_2_release_notes.mdの修正です。

上記テストの続きのようです。


third test to warn against reading guides in GitHub

guides/rails_guides/markdown/renderer.rbguides/source/2_2_release_notes.mdの修正です。

まだ上記テストの続きのようです。 文字列が"DO NOT READ THIS FILE IN GITHUB"に変わっています。


warn about reading guides in GitHub

各guideの修正です。

先頭に、**DO NOT READ THIS FILE IN GITHUB, GUIDES ARE PUBLISHED IN http://guides.rubyonrails.org.**という注意書きを追加しています。

Guideはhttp://guides.rubyonrails.org/で見るように構成されており、Github上で見るとリンクが適切に設定されないのですが、 どうもそのリンクが設定されないのをバグと勘違いし、修正のPRが送られてくるケースがあったようなので、 注意書きを追加したようです。


removes superfluous regexp group

guides/rails_guides/markdown/renderer.rbの修正です。

rails guide生成処理のparagraphメソッドにあった不要な正規表現のグルーピング処理を削除しています。


- Removed unused parameter to cookie serialize method and fixed usage of the same elsewhere

actionpack/lib/action_dispatch/middleware/cookies.rbの修正です。

SerializedCookieJars#serializeメソッドから使用していないname引数を削除しています。


Merge pull request #18107 from mkdynamic/add-reply-to-mail-to

actionview/lib/action_view/helpers/url_helper.rbの修正です。

mail_toメソッドのオプションにreply_toを指定出来るよう対応しています。

helper.mail_to("me@example.com", "My email", cc: "ccaddress@example.com", bcc: "bccaddress@example.com", subject: "This is an example email", body: "This is the body of the message.", reply_to: "foo@bar.com")
# => "<a href=\"mailto:me@example.com?cc=ccaddress%40example.com&amp;bcc=bccaddress%40example.com&amp;body=This%20is%20the%20body%20of%20the%20message.&amp;subject=This%20is%20an%20example%20email&amp;reply-to=foo%40bar.com\">My email</a>"