なるようになるブログ

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

rails commit log流し読み(2014/05/07)

2014/05/07分のコミットです。

昨日リリースされたCVE-2014-0130の対応がmasterにもコミットされました。また、labelメソッドにvalueを指定した時の挙動が変わっています。


Only accept actions without File::SEPARATOR in the name.

AbstractController::Base#processメソッドの修正です。

ディレクトリトラバーサルされてしまうセキュリティバグの修正です(CVE-2014-0130)。 昨日3.2.18, 4.0.5, 4.1.1 がリリースされたのは、このセキュリティバグの為ですね。


Ensure that .process return the method return

actionview/test/actionpack/abstract/render_test.rbの修正です。

.processメソッドの戻り値のテストを追加しています。


several enhancements to humanize [closes #12288]

humanizeメソッドの修正です。

Before:
  '_id'.humanize # => ""

After:
  '_id'.humanize # => "Id"

元々は、_idという文字列は全て空白にする仕様だったのですが、終端の_id以外は削除しないようにしています。


Include label value in i18n attribute lookup

ActionView::Helpers::Tags::Base::Label::renderメソッドの修正です。

labelメソッドにvalueを指定した場合に、I18nに指定されたmodel attributeの値を取得するようにしています。

# example

# form.html.erb
 <%= form_for @post do |f| %>
   <%= f.label :type, value: "long" %>   # Long-form Post
 <% end %>

# en.yml
en:
  activerecord:
    attributes:
      post/long: "Long-form Post"

割と使えそう。


typo [ci skip]

rails guideのActive Support Core Extensionsの修正です。タイポの修正のみ。


fix guides mobile nav issue [ci skip]

rails guideのcssの修正です。

モバイルのページで、矢印がズレてしまっていたのを修正しています。


add a test for the parameters sent to the url helper for new records

actionview/test/activerecord/polymorphic_routes_test.rbに新規レコードにパラメータを設定した時のテストケースを追加しています。


make sure url_for works similar to polymorphic_url

こちらもactionview/test/activerecord/polymorphic_routes_test.rbの修正です。

url_forメソッドのテストを追加しています。


apparently passing a string to polymorphic_url is something we support

こちらもactionview/test/activerecord/polymorphic_routes_test.rbの修正です。

polymorphic_urlメソッドにStringを渡した場合のテストケースが無かったのを追加しています。


[ci skip] Add feature section and normalize prologue with other guides.

rails guideのActive Record and PostgreSQLのページを修正です。

ページの先頭にサマリーの追加、リンク漏れの修正等を行っています。


Update links to new rails version in guides [ci skip]

rails guideの_welcome.html.erbの修正です。

昨日リリースされたバージョン(4.1.1/4.0.5/3.2.18)にリンク先を修正しています。

現状、このようなバージョンアップに伴うリンク先の修正が手動になっているようなのですが、今後は自動で行うようにするらしいです。


rename str to string to fix overshadowing of variable

railties/test/generators/argv_scrubber_test.rbの修正です。

変数名をstr->からstringに修正しています。

以前違うコミットでも同じような修正があったのですが、基本省略形は使わない方針なんですかねえ。


Follow-up to #14990 [ci skip]

ActiveRecord::Associations::HasManyAssociation::HasManyThroughAssociationのdocの修正です。

'we'/'you'の使用を避ける、ピリオド追加、1行を80文字にする、という修正が行われいます。

'we'/'you'の使用を避ける、のは何でなんだろう。


Fix state leaks in actionmailer/test/base_test.rb.

actionmailer/test/base_test.rbの修正です。

時折テストが壊れる事があったらしく、setup処理の追加、テストのブロック化、テストの順番入れ替え、等が行われています。


fixed typos in active_record basics [skip ci]

rails guideのActive Record Basicsページの修正です。typoの修正だけです。