なるようになるブログ

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

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

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

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

activerecord/CHANGELOG.md

activesupport/CHANGELOG.md

actionview/CHANGELOG.md


schema loading rake tasks maintain database connection for current env.

activerecord/lib/active_record/tasks/database_tasks.rbの修正です。

スキーマをロードするタスク(db:schema:loaddb:setupなど)で、現在の環境のDBコネクションを維持するよう修正しています。


copy edit AS core ext changes [ci skip]

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

グラマーの修正です。


Ship with rails-html-sanitizer instead.

ActionPack/ActionViewの修正です。

rails-deprecated_sanitizerの代わりにrails-html-sanitizerを使用するよう修正しています。


extract updating all fixture cache to a method so we can lock later

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

create_fixturesメソッドで行っているfixtureの更新処理を、update_all_loaded_fixturesメソッドに切り出しています。


Methods are not duplicable.

activesupport/lib/active_support/core_ext/object/duplicable.rbの修正です。

Methodオブジェクトについては、duplicate出来ないよう対応しています。

method(:puts).duplicable? # => false
method(:puts).dup         # => TypeError: allocator undefined for Method

確かに、普通に考えるとメソッドについては複製出来なくて良い気がしますねえ。


Add support for ARIA attributes in tags

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

tag出力処理、ARIA属性のサポートを追加しています。

<%= f.text_field :name, aria: { required: "true", hidden: "false" } %>
# => <input aria-hidden="false" aria-required="true" id="user_name" name="user[name]" type="text">

ARIA、正確には"WAI-ARIA"とは、Web Accessibility Initiative-Accessible Rich Internet Applicationsの略で、リッチなインターネットアプリケーションのアクセシビリティに関する仕様書との事だそうです。知らなかった。詳細は、W3C参照。


Extract data/aria attribute prefixes to a constant

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

コード内にべたに定義されていたprefixを定数に切り出しています。


code gardening in ActionController::Renderers

actionpack/lib/action_controller/metal/renderers.rbの修正です。

諸々リファクタリングを行っています。

  • _handle_render_options_render_to_body_with_rendererにリネーム
  • メソッド名生成の為の_render_with_renderer_method_nameの作成
  • 不要なselfの削除

[ci skip] Fix typo in rails guide for routing

rails guideのRails Routing from the Outside Inの修正です。

タイポの修正です。


get rid of shadowing warning when running tests AR and railtie tests.

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

add_constraintsメソッドで、同名の変数がありwarningが出力されていたので、変数名を修正しています。


build fix, we have to reset the RACK_ENV as well.

railties/test/application/rake/dbs_test.rbの修正です。

テストの前処理で元々のRAILS_ENVRACK_ENVの値を保持してい、後処理で元の値に戻すよう修正しています。


Enums shouldn't ruin people's anniversaries

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

BLACKLISTED_CLASS_METHODSallocatenewnameparentsuperclassを追加しています。

元々はprivatepublicprotectedだけだったのですが、enumのkeyにparent等の値を指定されると、エラーになってしまので、重要なメソッドを追加しています。


Follup to PR #16762

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

"#16762"で行った変数名の修正について、もう少し適切な名前に変数名を修正しています。


Fix a warning

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

メソッドと引数の間に不要なスペースがある、ワーニングが出てしまっていたので、スペースの削除を行っています。