なるようになるブログ

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

rails commit log流し読み(2014/08/19)

2014/08/19分のコミットです。

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

activerecord/CHANGELOG.md


Sync railties release notes [ci skip]

guides/source/4_2_release_notes.mdの修正です。

railtiesのrelease noteを反映しています。


Check attributes passed to create_with and where

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

create_withwhereメソッドに渡すattributesについて、sanitize処理を行うよう修正しています。CVE-2014-3514 fix対応。

以下のような使い方をしている場合に問題が起きるとの事です。

user.blog_posts.create_with(params[:blog_post]).create

ワークアラウンド

  user.blog_posts.create(params[:blog_post])

# or:

  user.blog_posts.create_with(params[:blog_post].permit(:title, :body, :etc)).create

詳細はこちら


Sync action pack release notes [ci skip]

guides/source/4_2_release_notes.mdの修正です。

ActionPackのrelease noteを反映しています。


:nail_care: [ci skip]

guides/source/4_2_release_notes.mdの修正です。

インデントの整理。


Use the released beta of i18n

Gemfileactivesupport/activesupport.gemspecの修正です。

i18nについて、リリース済みのgemを使用するよう修正しています。


Add option to stop swallowing errors on callbacks.

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

現状、after_rollback/after_commit コールバックでエラーが発生した際は、一旦rails側でエラーをrescueして、エラーをログファイルに出力していたのですが、次のバージョンでは、 rescueは行わなくするとの事です。

先にこの振る舞いについて確認したい場合は、

config.active_record.raise_in_transactional_callbacks = true

を設定すれば、確認出来るとの事です。


No need to point to arel and i18n master anymore

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

生成されるGemfileからarel、rack、i18nを削除しています。


Fix assertion to map the behaviour of the old sanitizer

actionview/test/template/sanitize_helper_test.rbの修正です。

以前のサニタイザの動作と合ってる事を確認するように、test_should_sanitize_illegal_style_propertiesを修正しています。


Bump rack dependency

actionpack/actionpack.gemspecの修正です。

rackのバージョンをalphaからbetaに修正しています。


Rack is released too

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

最新のrackがリリースされたので、生成されるGemfileからrackを削除しています。


fix broken link [ci skip]

rails guideのA Guide for Upgrading Ruby on Railの修正です。

PATCHメソッドについて説明した記事へのリンクが切れていたのを修正しています。


[ActiveJob] Add queue_name_prefix so all queue are prefixed .

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

mattr_accessorにqueue_name_prefixを追加しています。

ActiveJob::Base.queue_name_prefix = 'foo'

環境毎とかに分けて管理する事が出来そうですね。ちょっと便利そう。


Add activejob guide to documents.yml [ci skip]

guides/source/documents.yamlの修正です。

Active Job を追加しています。


Fixes the Relation#exists? to work with polymorphic associations.

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

polymorphic associationsを使用している時に、Relation#exists?メソッドが正常に動作してなかったバグを修正しています。


Fix broken link to Upgrading Ruby on Rails Guide

rails guideのRuby on Rails 4.2 Release Notesの修正です。

4.1から4.2へのUpgrading guideへのリンクが壊れていたのを修正しています。


Fix after_commit warning message

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

上であったafter_rollback/after_commit コールバックのエラー対応で、出力するエラーメッセージにtypoがあったのを修正しています。


Deprecate TagAssertion instead of removing

actionpack/lib/action_dispatch/testing/assertions/tag.rbの修正です。

削除されてしまったTagAssertionsを戻してく、Deprecateメッセージを出すよう修正しています。


Removed warning

actionview/test/activerecord/controller_runtime_test.rbの修正です。

使用していない変数を削除しています。


Point to unreleased deprecated_sanitizer

Gemfileの修正です。

rails-deprecated_sanitizerを追加しています。


Remove to_s from reflection.type in add_constraints

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

不要なStringへの変換処理を削除しています。


Merge pull request #16542 from seamusabshere/numerify-pool-checkout-timeout-from-urls-4-1-stable

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

checkout_timeoutパラメータのチェック処理を追加しています。

-        @checkout_timeout = spec.config[:checkout_timeout] || 5
+        @checkout_timeout = (spec.config[:checkout_timeout] && spec.config[:checkout_timeout].to_f) || 5

spec.config[:checkout_timeout]にStringが設定されて場合に、エラーになっていた為対応したようです。


require 'test_help' -> require 'rails/test_help'

rails guideのA Guide for Upgrading Ruby on Railsの修正です。

require 'test_help' を require 'rails/test_help'に修正しています。


Add missing require

actionpack/lib/action_dispatch/testing/assertions/tag.rbの修正です。

require 'active_support/deprecation'を追加しています。


Mention deprecation of assert_select and friends in the release notes [ci skip]

guides/source/4_2_release_notes.mdの修正です。

Deprecatedの項に、assert_tag, assert_no_tag, find_tagfind_all_tag を追加しています。


Sync Action View release notes [ci skip]

guides/source/4_2_release_notes.mdの修正です。

ActionViewのrelease noteを反映しています。


Sync Action Mailer release notes [ci skip]

guides/source/4_2_release_notes.mdの修正です。

ActionMailerのrelease noteを反映しています。


Removed unnecessary word

rails guideのGetting Started with Railsの修正です

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


[ci skip] config.active_record.errors_in_transactional_callbacks -> config.active_record.raise_in_transactional_callbacks

activerecord/CHANGELOG.mdの修正です。

raise_in_transactional_callbackserrors_in_transactional_callbackstypoしていたのを修正しています。


http://gembundler.com/ => http://bundler.io/

rails guideのDevelopment Dependencies Installの修正です。

http://gembundler.com/http://bundler.io/ に修正しています。


4.2 Release Notes pass [skip ci]

rails guideのRuby on Rails 4.2 Release Notesの修正です。

グラマーの修正です。


Merge pull request #16552 from untidy-hair/update_plugin_guide

rails guideのThe Basics of Creating Rails Pluginsの修正です。

サンプルの内容を最新の内容に更新しています。


use same idiom to define class method as in every other adapter.

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

クラスメソッドの定義方法を、def self.xxxからclass << selfに修正しています。

-        def self.perform(job_name, *args)
-          job_name.constantize.new.execute(*args)
+        class << self
+          def perform(job_name, *args)
+            job_name.constantize.new.execute(*args)
+          end

railsのコーディング規約的には、class << selfを推奨しており、他のadapterもその書き方をしているので、合わせた形ですね。


"warning: assigned but unused variable"

activesupport/test/multibyte_chars_test.rbの修正です。

使用していない変数を削除しています。


Gem queue_classic does not support JRuby

Gemfileの修正です。

queue_classicJRubyでサポートしていないという事で、platforms: :rubyの指定を追加しています。


Skip adapter queue_classic for JRuby

activejob/Rakefileの修正です。

JRubyの場合にadapterからqueue_classicを削除しています。


Merge pull request #16487 from jayshepherd/patch-1

rails guideのActive Record Query Interfaceの修正です。

グラマーの修正です。不要なaを削除しています。