なるようになるブログ

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

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

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

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

activerecord/CHANGELOG.md

activesupport/CHANGELOG.md


Fix TypeError in Fixture creation

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

fixtureファイルで$LABELを使用した際、LABELがString以外(Integer等)だった場合にエラーになっていたのを修正しています。


Add firebird support to test suite

ActiveRecordのテストの修正です。

adapterがFirebirdの場合にテストが実行されるよう修正しています。 Firebird、使われてるんですかねえ。


Merge pull request #17676 from tigrish/fix_custom_i18n_exception_handler_regression

actionview/lib/action_view/helpers/translation_helper.rbの修正です。

translateメソッドで、指定されたkeyが存在しない場合に、エラーをraiseする条件に誤りがあったのを修正しています。

raiseオプションがfalse、又はオプションにrescue_formatの指定があって、その値がnilの場合は、エラーをraiseしない、が正しい挙動のようです。


Avoid changing the global state on the tests

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

setup処理でI18n.exception_handlerの値を変更していたのを、テストの中で値を変更し、テストのensure処理で元の値に戻すよう修正しています。


Fix rollback of primarykey-less tables

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

primary keyが無いtableに対するrollback処理を行った時、ActiveModel::MissingAttributeError: can't write unknown attributeが起きてしまっていたバグがあったのを修正しています。


Whitespace fixes from #18349

activerecord/test/cases/transactions_test.rbの修正です。不要な空行を削除しています。


Define attribute methods before attempting to populate records

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

define_attribute_methodsinit_internalsinitialize_internals_callbackメソッドの呼び出し前に定義するよう修正しています。

initialize_internals_callbackでattributesの操作処理を行うケースがあり、その場合にエラーになってしまっていた為、定義位置を修正したようです。


Correctly fetch bind_values from join in subquery

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

bind_valuesの設定処理をbuild_fromメソッドで行っていたのをfrom!メソッドで行うよう修正しています。

fromメソッド内のサブクエリーでjoinをしていた場合に、エラーになってしまっていた為対応しています。


Improve protect_from_forgery documentation. [ci skip].

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

protect_from_forgeryメソッドについての説明を修正しています。


adding documentation for 'remove_possible_method' and 'redefine_method' [ci skip]

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

remove_possible_methodredefine_methodメソッドのdocを削除しています。

これは何でだろう。:nodoc:を追加している訳でも無いんですよねえ。


removing unecessary parameter in private method

activemodel/lib/active_model/naming.rbの修正です。

_singularizeメソッドから不要な引数を削除しています。


Add #on_weekend?, #next_weekday, and #prev_weekday methods to Date, Time, and DateTime

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

DateTimeDateTime#on_weekend?#next_weekday#prev_weekdayメソッドを追加しています。

on_weekend?メソッドは土曜か日曜の場合にtrueを、それ以外の曜日の場合はfalseを返します。

next_weekdayは次の平日を返します。なので、月〜木の場合は、単純に翌日を、金曜の場合は次の曜日のdate/timeオブジェクトを返します。prev_weekdayはその逆ですね。


Add same_time option to #prev_week and #next_week for Date, Time, and DateTime

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

prev_weeknext_weekメソッドsame_timeオプションを追加しています。

Time.now.next_week
=> 2015-01-12 00:00:00 +0900

Time.now.next_week(same_time: true)
# => 2015-01-12 06:45:47 +0900

現在時刻を保持する為のオプションなんですねえ。


Add #prev_day and #next_day as counterparts to #yesterday and #tomorrow for Date, Time, and DateTime

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

DateTimeDateTimeprev_daynext_dayメソッドを追加しています。

翌日/前日のdate/timeのインスタンスを返します。 tomorrow / yesterdayと一緒です。


Fix lookup of fixtures with non-string label

activerecord/test/cases/fixtures_test.rb

先に行われたfixtureファイルLABELにString以外の値を使用した際の対応について、テストを追加しています。


replacing 'attribute' method with an alias

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

attributeメソッド_read_attributeメソッドエイリアスに修正しています。


Fixed typos and wording in ActiveRecord CHANGELOG [ci skip]

activerecord/CHANGELOG.mdの修正です。タイポの修正を行っています。


Add log_level options to configuration guide

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

config.log_levelの説明をしている箇所に、設定可能なログレベルについての説明を追加しています。