なるようになるブログ

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

rails commit log流し読み(2016/03/11)

2016/03/11分のコミットです。

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

activesupport/CHANGELOG.md


remove obsolete i18n links from guides [ci skip]

rails guideのRails Internationalization (I18n) APIの修正です。

guide内にあった既に存在しないページへのリンクを削除しています。


Version 3.1.11 works on Windows again

Gemfileの修正です。

bcryptのv3.1.11を使用するよう修正しています。

3.1.0で起こっていたWindowsで動かない問題が解消されている為、との事です。参考:Ruby 2.2.2 on Windows - LoadError: cannot load such file -- bcrypt_ext · Issue #128 · codahale/bcrypt-ruby


Fix Gemfile.lock

Gemfile.lockの修正です。

先のGemfileの修正の際、lockファイルの更新が漏れていたので、更新しています。


Remove unfinished command infrastructure.

railties/lib/rails/command.rbrailties/lib/rails/commands.rbの修正です。

Rails::Commandクラスを削除しています。元々、ユーザが任意にコマンドを登録出来るようにする予定があった(筈)なのですが、作業が途中になってしまっており、Rails 5.0には間に合わない為、途中になってしまっていたコードを一旦削除したようです。


Merge pull request #24145 from bdewater/remove_try_require

activesupport/lib/active_support/values/time_zone.rbの修正です。

使用していないactive_support/core_ext/object/tryのrequireを削除しています。


Add missing require to try

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

こちらは使用しているのにrequireがされてなかったので、active_support/core_ext/object/tryのrequireを追加しています。


Merge pull request #24129 from dharamgollapudi/rename_dependencies_rake

action_view/tasks/dependencies.rakeaction_view/tasks/cache_digests.rakeにリネームしています。

cache_digestsに関する処理が定義されているrakeファイルの為、との事です。


Merge pull request #23958 from kamipo/fix_bigserial_appears_with_limit_8

activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rbの修正です。

PostgreSQLのbigserialカラムをdumpした際に、不要なlimit: 8オプションが設定されてしまっていたのを、設定されないよう修正しています。


Extract default_primary_key? to refactor column_spec_for_primary_key

Active Recordの修正です。

column_spec_for_primary_keyメソッドのリファクタの為に、primary keyのチェック処理をメソッド(default_primary_key?)に切り出しています。


Dump bigint instead of integer with limit: 8 for schema dumper

Active Recordの修正です。

bigint型のカラムをdumpする際、limit: 8が指定されたintegerとして出力されていたのを、bigintとして出力するよう修正しています。

# before
create_table "big_numbers", force: :cascade do |t|
  t.integer "bigint_column", limit: 8
end

# after
create_table "big_numbers", force: :cascade do |t|
  t.bigint "bigint_column"
end

Prevent Marshal.load from looping infinitely

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

Marshal.loadメソッドで、constantをautoloadする際に、そのクラスがmarshalした際にと違う名前になっていた際に、無限ループしてしまうバグがあったのを修正しています。

Active Record 4.0で作成したオブジェクトをmarshalし、そのデータをRails 4.2でunmarshalしようとした所、Columnクラスの名前が変わっていた(4.0ではActiveRecord::ConnectionAdapters::Mysql2Adapter::Columnで、4.2ではActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::Column)為、問題が発生したとの事です。


Fix thread_mattr_accessor thread-local variable naming

activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rbの修正です。

thread_mattr_reader / thread_mattr_writerメソッドで、スレッドローカル変数を設定する際の名前に、クラス名を使用していたのを、インスタンス名を取得するよう修正しています。

-            Thread.current[:"attr_#{self.class.name}_#{sym}"]
+            Thread.current[:"attr_#{name}_#{sym}"]

インスタンスの方が名前としてわかりやすいため、との事のようです。


use ActiveSupport::Reloader.to_prepare instead of deprecated ActionDispatch::Reloader.to_prepare [ci skip]

activesupport/lib/active_support/file_update_checker.rbのdocの修正です。

FileUpdateCheckerのdocにあるexampleで、deprecatedになったActionDispatch::Reloader.to_prepareを使用していたのを、ActiveSupport::Reloader.to_prepareを使用するよう修正しています。


Merge pull request #23677 from kamipo/passing_table_name_to_column_initialize

Active Recordの修正です。

Columnクラスでtable名をinstance_variable_getを使用して取得していたのを、Column.newの引数にtable名を渡すようにして、instance_variable_getは使用しないで済むよう修正しています。