なるようになるブログ

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

rails commit log流し読み(2015/04/13)

2015/04/13分のコミットです。

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


Error message no longer tells you to set the (deprecated) secret_token.

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

secret_key_basesecret_token両方設定されてない場合に表示されるメッセージに、secret_tokensecret_key_baseを設定しろ、となっていたのですが、 secret_tokenはdeprecatedになっている為、エラーメッセージからsecret_tokenは削除しています。


view paths docs [ci skip]

rails guideのAction View Overviewの修正です。

View Pathsの項にprepend_view_pathappend_view_pathメソッドについての説明を追加しています。


:scissors:

railties/CHANGELOG.mdの修正です。

不要な空行を削除しています。


Merge branch 'mfazekas-action-mailer-async-doc-fixes'

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

ActionMailerによるメール送信についての説明が、同期送信前提の説明になってしまっていたので、非同期送信についての説明を追加しています。


Some copy edits for modifying View Paths [ci skip]

rails guideのAction View Overviewの修正です。

先に追加されたView Pathsの説明について、整理編集(サンプルの追加、グラマーの修正)を行っています。


Speedup String#squish

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

String#squish!メソッドで文字列から不要文字を削除する際、gsub!を使用していたのをstrip!を使用するよう修正しています。

-    gsub!(/\A[[:space:]]+/, '')
-    gsub!(/[[:space:]]+\z/, '')
     gsub!(/[[:space:]]+/, ' ')
+    strip!

高速化の為との事です。PRにあったbenchmarkは以下の通りです。

Calculating -------------------------------------
              squish    45.000  i/100ms
          new_squish   106.000  i/100ms
-------------------------------------------------
              squish    445.238  (± 7.4%) i/s -      2.250k
          new_squish      1.094k (± 5.3%) i/s -      5.512k

Fix (intermittent?) test failure

activerecord/test/cases/schema_dumper_test.rbの修正です。

column typeについてのテストで、指定可能な型をテスト内で全て定義していたのをを、正規表現でマッチするよう修正しています。

-        if match = column.match(/t\.(?:integer|decimal|float|datetime|timestamp|time|date|text|binary|string|boolean|xml|uuid|point)\s+"/)
+        if match = column.match(/\bt\.\w+\s+"/)

テストコードで全部ベタに持つ必要は無いだろう、という事で修正したようです。


Merge pull request #19564 from jonatack/counter_cache_docs

rails guideのActive Record Associationsの修正です。

counter_cacheについて説明している箇所を修正しています。修正内容は以下のとおり。

  • has_many側にもcounter_cacheの設定をしていたのを削除
  • counter_cacheに任意のカラム名を指定する場合についての説明を、 別段落に切り出し
  • NOTE部分でcounter_cachehas_many側に設定する旨説明していたのを、belongs_to側に設定する必要がある旨説明を修正

Enhance documentation of pluck with a hint to ids [ci skip]

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

pluckメソッドのサンプルにidカラムを使用していたのを、nameカラムを取得するよう修正しています。idが取得したい場合は、idsメソッドを使用すれば良いので、id以外のカラムを取得するよう修正したようです。


Apply comments from @rafaelfranca: we shouldn't recommend you use scaffold css

rails guideのGetting Started with Enginesの修正です。

rails engine内のapplication.html.erbscaffold.cssを使用する場合の例が記載されていたのですが、engineはデフォルトではscaffold.cssを読み込まないし、engineでscaffold.cssを使用するのはオススメしない、という事で削除したようです。


Apply edits from @senny to close #19397 [ci skip]

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

中間テーブル作成する為のexampleで、create_join_tableメソッドを使用するよう修正しています。


Revert "Merge pull request #19682 from supercaracal/fix_force_ssl_redirection_flash_error"

Fix fails to force_ssl_redirection if session_store is disabledのコミットをrevertしています。

対応内容がおかしいと思われる、かつ、rails-api のテストが壊れてしまった為、revertしたとの事です。


Add note wrt foreign key constraint to ensure data integrity

rails guideのActive Record Associationsの修正です。

ユニークインデックスと外部キー制約を同時に設定する場合のサンプルを追加しています。


Add a note regarding add_column restricted API [ci skip]

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

add_columnメソッドのdocにTableDefinition#columnで定義されている全てのオプションが使える訳ではない旨noteを追記しています。


update request_forgery_protection docs [ci skip]

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

Request Forgery protectionの説明を現在の実装内容に合わせて更新しています。


Apply comments from @jeremy regarding why HTML and Javascript requests

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

web browserからのリクエストに対して何故CSRF protectionを行わなければならないのか、説明を追加しています。


Add note regarding CSRF for APIs, as a use-case for skipping it [ci skip]

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

何故APIからのリクエストの場合は、CSRF protectionを無効にすべてきなのか、説明を追加しています。


Document that partial indexes are only supported by Postgres and SQLite.

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

Partial indexes はPostgreSQLSQLite 3.8.0+でのみサポートしている旨noteを追加しています。


Fix the wrong documentation about config.autoload_paths [ci skip]

rails guideのAutoloading and Reloading Constantsの修正です。

config.autoload_pathsは環境ごとの設定ファイルからでは更新出来ない旨説明を追加しています。 config.autoload_pathsはfrozenされてしまっているので、更新出来ないん ですねえ。


Improve note about unique index and foreign key on has_one association

rails guideのActive Record Associationsの修正です。

ユニークインデックスと外部キー制約を同時に設定する場合のexampleについて、説明の修正及びexampleから不要なスペースの削除を行っています。