なるようになるブログ

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

rails commit log流し読み(2015/01/05)

2015/01/05分のコミットです。

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

deprecateになっていたメソッド/クラスの削除、挙動の変更に関する対応、及び、Ruby 2.2未満用のパッチ・ワークアラウンド処理の削除対応が行われています。

railties/CHANGELOG.md

activerecord/CHANGELOG.md

actionpack/CHANGELOG.md


Remove deprecation warning when log_level is not explicit set on production

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

production envでlog_levelが未設定の場合に出力していたwarnメッセージを削除しています。


Remove deprecated serve_static_assets configuration

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

deprecateになっていたconfig.serve_static_assetsを削除しています。


Remove deprecated RAILS_CACHE constant

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

deprecateになっていたRAILS_CACHE定数を削除しています。


Remove deprecated Rails::Rack::LogTailer

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

deprecateになっていたRails::Rack::LogTailerクラスを削除しています。


Remove deprecated test:all and test:all:db tasks

railties/lib/rails/test_unit/testing.rakeの修正です。

deprecateになっていたtest:alltest:all:dbタスクを削除しています。


Remove unneeded requires

コンポーネントから、不要なrequiresを削除しています。


Merge pull request #18321 from mackshkatz/master

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

Model.find(options)を実行した際に呼び出されるcallbackの説明にafter_initializeが漏れていたので、追加しています。


Fix CHANGELOG [ci skip]

railties/CHANGELOG.mdの修正です。

CHANGELOGに名前を追加するのが漏れていたのを対応しています。


Remove unneeded require 'as/deprecation'

各ファイルから、'active_support/deprecation'を削除しています。


Add has_secure_token to Active Record

ActiveRecordの修正です。ActiveRecordhas_secure_tokenメソッドを追加してます。

例。

# Schema: User(toke:string, auth_token:string)
class User < ActiveRecord::Base
  has_secure_token
  has_secure_token :auth_token
end

user = User.new
user.save
user.token # => "44539a6a59835a4ee9d7b112"
user.auth_token # => "e2426a93718d1817a43abbaa"
user.regenerate_token # => true
user.regenerate_auth_token # => true

Simplify boolean casting logic

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

Boolean#cast_valueメソッドリファクタリングです。booleanクラスへの変換処理を修正しています。


Use directly TZInfo::Timezone without proxy

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

find_tzinfoメソッドTZInfo::TimezoneProxyインスタンスではなく、TZInfo::Timezoneインスタンスを作成するよう修正しています。

timezoneがロードされてない場合を考慮してTimezoneProxyを使ってたようなのですが、createメソッドの延長で必ずロードされるので、 TimezoneProxyを使用するのは不要との事で削除したようです。


remove files which is dependent on ruby1.9 as we do not support Ruby1.9

activerecord/lib/active_record/attribute_methods/read.rbactiverecord/lib/active_record/attribute_methods/write.rb activesupport/lib/active_support/core_ext/module/method_transplanting.rbの修正です。

Ruby 1.9サポートの為に使用していたModule.methods_transplantable?メソッドを削除しています。


Remove hack to support BigDecimal in Ruby 1.9

activesupport/lib/active_support/core_ext/object/duplicable.rbactivesupport/test/core_ext/object/duplicable_test.rbの修正です。

Ruby 1.9サポートの為に行っていてBigDecimalクラスのチェック処理を削除しています。


Remove Psych hack for Ruby 1.9

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

Ruby 1.9サポートの為に行っていたPsychクラスへのyメソッドの追加処理を削除しています。


Remove Thread hack for Ruby 1.9

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

RUBY_VERSIONのチェック処理を削除しています。 Ruby 1.9だと動作しないテストがあり、そのテストを避ける為にチェック処理を入れていたようです。


Remove LoadError#path hack for Ruby 1.9

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

RUBY_VERSIONのチェック処理を削除しています。 LoadError#pathメソッドが1.9系に存在しない為、スキップする必要があるテストがあった為チェックを入れていたようです。


Remove version conditional for find_template_paths

actionview/lib/action_view/template/resolver.rbの修正です。

Rubyのバージョンにより処理を分けていたのを、古いバージョンの処理を削除しています。 File.fnmatchメソッドが使えるかどうかでの違いでした。


Remove version conditional for calling GC.disable

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

Rubyのバージョンチェックを削除しています。


Remove debugger support

1.9系サポート終了に伴い、debugger gemに関する処理をすべて削除しています。


No need to disable sidikiq tests with 1.9.3 anymore

activejob/test/helper.rbの修正です。

Ruby 1.9.3の場合sidekiqのテストを行わないようにしていたのですが、そのチェック処理を削除しています。Ruby 1.9.3ではSidekiqは動かないとの事。


Remove wrong TODO comment

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

誤ったTODOコメントがあったのを削除しています。


Remove some comments about Ruby 1.9 behaviors

1.9 - 2系で微妙に挙動が異なるケースがあり、その挙動についてコメントに記載されていたのを一通り削除しています。


Remove unneeded Time patch to support Ruby 1.9

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

Ruby 1.9.2の為に必要だったTimeクラスへのパッチを削除しています。


singleton_class? is already pressent at Ruby 2.2

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

singleton_class?メソッドを削除しています。Ruby本体で提供済みの為。


String already respond_to scrub at Ruby 2.2

activesupport/lib/active_support/multibyte/unicode.rbの修正です。

Stringscrubメソッドを呼び出せるかどうかチェックしている処理を削除しています。


Remove Struct#to_h backport

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

Struct#to_hメソッドを削除しています。これも、Ruby本体でサポート済みの為。


Remove workaround to a Ruby 2.0.0 bug

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

Duration#===メソッドを削除しています。

Ruby 2.0.0-p353にあったバグの為のワークアラウンドとの事。


Remove extra class_eval for Ruby 1.9

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

Ruby 1.9の為にあったclass_evalメソッドの呼び出しを削除しています。


Remove respond_to/respond_with placeholder methods

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

deprecateメッセージを出力する為に残していたrespond_to/respond_withメソッドを削除しています。


Remove unused require

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

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


Do not include Active Support on tests

activesupport/test/xml_mini/nokogiri_engine_test.rbactivesupport/test/xml_mini/nokogirisax_engine_test.rbactivesupport/test/xml_mini/rexml_engine_test.rbの修正です。

各テストで行っていたjActiveSupportinclude処理を削除しています。includeする必要は無いだろう、との事。


[guides] Added newer find_by syntax example in 4.2 release notes for Adequate Record [skip ci]

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

Adequate Recordの項のexampleにfind_byメソッドのexampleを追加しています。


Document all options for protect_from_forgery.

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

protect_from_forgeryメソッドのdocで、:if/:unlessオプションについての説明が無かったのを追加しています。


add punctuation. [ci skip]

activerecord/CHANGELOG.mdの修正です。

クラス名をバッククォートでくくるよう修正しています。


remove deprecation warning when modifying a Relation with cached arel.

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

cacheされてた@arelとrelationが一緒に変更になった時に出力されてたdeprecateメッセージが削除され、ImmutableRelationがraiseされるよう修正されています。


can't kill thread with in-memory db. fixes rake test:sqlite3_mem.

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

threadをkillした場合にrollbackされる事の確認の為のテストを、in memory dbの場合は行わないよう修正しています。


remove deprecated support for PG ranges with exclusive lower bounds.

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

deprecateになっていた、PostgreSQLのarrayに小括弧から始まる値を指定された場合の処理が削除されています。

(1, 10]のような書き方が出来ていたとの事。知らなかった。


remove deprecated support to preload instance-dependent associaitons.

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

deprecateになっていたinstance dependent associationsのpreloading / eager loading処理を削除しています。


Fix typo in changelog [ci skip]

activerecord/CHANGELOG.mdの修正です。タイポの修正。


remove unneeded check since /_one_time_conditions/ is removed

actionpack/lib/abstract_controller/base.rbの修正です。

action_methodsメソッドでmethodの一覧を作成する際、_one_time_conditionsという名前のメソッドは除外しようとしているのですが、 そもそもどこにも_one_time_conditionsという名前のメソッドは無いので、除外処理を削除しています。


Reset template assertions without warnings

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

存在しない変数に対してinstance_variable_getをしようとしてwarningが出てしまっていたので、instance_variable_defined?で対象の変数が存在するかチェックするよう修正しています。


reflects changes in 34cd7e2 in the index [ci skip]

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

"Constant Autoloading and Reloading" guideを "Autoloading and Reloading Constants"に修正しています。


Clean up secure_token_test

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

has_secure_tokenメソッドに関するテストの、テスト名の整理を行っています。