なるようになるブログ

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

rails commit log流し読み(2016/04/26)

2016/04/26分のコミットです。

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

activesupport/CHANGELOG.md


Add require of mattr_accessor since Compatibility relies on it.

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

active_support/core_ext/module/attribute_accessorsのrequireを足りてなかったのを追加しています。


Move remaining current_savepoint_name to savepoints module

activerecord/lib/active_record/connection_adapters/abstract/savepoints.rbactiverecord/lib/active_record/connection_adapters/abstract_adapter.rbの修正です。

AbstractAdapterクラスに定義されていたSAVEPOINT name 取得用のメソッド(#current_savepoint_name)をActiveRecord::ConnectionAdapters::Savepoints module配下に移動しています。


Dont simply assume a type is a valid database type. This is only always true in the case of sqlite.

activerecord/lib/active_record/connection_adapters/abstract_adapter.rbactiverecord/lib/active_record/connection_adapters/sqlite3_adapter.rbの修正です。

ActiveRecord::ConnectionAdapters::AbstractAdapter#valid_type?メソッドがtrueを返すようになっていたのを、falseを返すよう修正しています。

      def valid_type?(type)
-        true
+        false
       end

sqlite adapterは必ずtrueを返すようにしたい為にtrueを返すようになっていたようなのですが、本来このチェックは各connection adapterで行うべきもの(mysql adapter、postgresql adapterは行っている)で、sqlite adapterの為にtrueを返すのはおかしいだろう、という事でAbstractAdaptervalid_type?はfalseを返すようにし、代わりにSQLite3Adapterクラスvalid_type?メソッドを追加し、そちらでtrueを返すように修正しています。


CI: allow JRuby build to fail, too flaky to be useful

.travis.ymlの修正です。

allow_failuresjruby-9.0.5.0を追加しています。buildが不安定だからですかね。


Do not cache ActiveSupport::TimeZone#utc_offset

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

ActiveSupport::TimeZoneクラスでutc offsetの値をキャッシュしていたのを、キャッシュしないよう修正しています。

アプリ動作中に夏時間になってしまった場合、utc offsetの値が変わってしまうからキャッシュしないようにしたようです。夏時間大変そう。


Merge pull request #24641 from rafaelfranca/fix-per-form-token-with-full-url https://github.com/rails/rails/commit/9364d50654a791e6405b0a14854ab08cd5420cab

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

per-form tokenを生成する際に、schemaとhostの情報を使用しないよう修正しています。

      def normalize_action_path(action_path)
-        action_path.split('?').first.to_s.chomp('/')
+        uri = URI.parse(action_path)
+        uri.path.chomp('/')
       end

pathの比較だけをしたいので、schema、hostの情報は不要な為。また、schema、hostの情報が含まれてしまっていると、tokenの比較処理でエラーになってしまう為のようです。


Clear ActionMailer deliveries on setup and teardown

actionmailer/lib/action_mailer/test_case.rbの修正です。

ActionMailer::TestCaseクラスのsetupとteardownでActionMailer::Base.deliveriesをclearするよう修正しています。


Little perfomance fix for Array#split.

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

Array#splitで、不要なconcat処理等を行わないようリファクタリングを行っています。


Fix typo in Rails Guides [ci skip]

rails guideのConfiguring Rails Applicationsの修正です。

compatibilitycompatabilityにタイポしている箇所があったのを修正しています。