2017/05/30分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Add default option to class_attribute
- Add
Date#prev_occurring
andDate#next_occurring
to return specified next/previous occurring day of week.
Add option for class_attribute default (#29270)
Active Supportの修正です。
class_attribute
メソッドにデフォルト値を設定出来るよう修正しています。
# before :settings self.settings = {} # after class_attribute :settings, default: {}
Merge pull request #29248 from yawboakye/rename-should-rename-table-pkey
activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
の修正です。
PostgreSQL adapterでrename_table
メソッドを実行した際に、table名に合わせてprimary key名も変更するよう修正しています。
Pass params FILE and LINE + 1 if class_eval with <<
ctionpack/lib/action_dispatch/journey/route.rb
の修正です。
Journey::Route
クラスでverb用のメソッドをclass_eval
で生成する際に、引数に__FILE__
、__LINE__
を渡すよう修正しています。
Merge pull request #29151 from onemanstartup/jquery_slim_fix
actionview/app/assets/javascripts/rails-ujs/start.coffee
の修正です。
jQuey
が定義されているかどうかチェックする際に、jQuery.ajax
が定義されているかどうかもチェックするよう修正しています。
jQuery slim versionではjQuery.ajax
は使用出来ない為、とのことです。へー。
参考:jQuery 3.2.1 Is Now Available, With Some Hotfixes | Official jQuery Blog
Remove extra block for assert_changes
[ci skip]
rails guideのA Guide to Testing Rails Applications
の修正です。
Rails Specific Assertions
の項、assert_changes
メソッドの引数ついて説明している箇所にblockパラメータが2つあったのを削除しています。
Add missing “not” in the doc for assert_no_changes
[ci skip]
activesupport/lib/active_support/testing/assertions.rb
の修正です。
assert_no_changes
メソッドのdocで説明に誤りがあったのを修正しています。
Gemfile.lock
の修正です。
RuboCopのバージョンを0.49.1に更新しています。
actionview/app/assets/javascripts/README.md
のdocの修正です。
各項のグラマーの修正を行っています。
activesupport/CHANGELOG.md
の修正です。
ActiveSupport::CurrentAttributes
をバッククオートで囲むよう修正しています。
Fix indentation + remove blank line
activesupport/CHANGELOG.md
の修正です。
不要な空行の削除、インデントの調整を行っています。
Do not use UTF8 in test SecretsCommandTest#test_edit_secrets
railties/lib/rails/secrets.rb
、
railties/test/commands/secrets_test.rb
の修正です。
テスト内のassertionでASCIIに無い文字を使用している箇所があったのを削除しています。LC_ALL=C
の環境でエラーになってしまうのを避ける為、との事です。
rails guideのActive Record Query Interface
の修正です。
OR Conditions
の項のグラマーの修正を行っています。
Fix UUID column with null: true
and default: nil
activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb
の修正です。
UUID
columnにnull: true
とdefault: nil
を一緒に指定した場合に、エラー(undefined method
include?‘ for nil:NilClass)になってしまうバグがあったのを修正しています。
Merge pull request #29273 from kamipo/deserialize_raw_value_from_database_for_json
Active Recordの修正です。
AbstractJson#changed_in_place?
でDBから取得した値のdeserialize処理を行うよう修正しています。
JSON型はスペースや、keyの順番等データは同じでも表現が変わってしまう場合があり、そういう問題が発生しないようにする為に、変更があったかどうかのチェックの際に deserialize処理を行うようにしたようです。
Merge pull request #29098 from kamipo/fix_association_with_extension_issues
Active Recordの修正です。
extension処理の修正として、default_scope
に対してextending
した場合にextending
したmoduleが呼ばれないバグがあったのを修正、既存のメソッドのカスタマイズにするのにmethod_missing
を使用出来なかったのを修正、extendの影響範囲を一つのassoctionに閉じるよう修正、等を行っているようです。多分。
Add an extra test showing why collections are cached
activerecord/test/cases/associations_test.rb
の修正です。
proxy objectをstubする事が出来ることを確認するテストを追加しています。
Don’t expose methods and attrs for internal usage
Active Recordの修正です。
内部でだけ使用しているattributesの可視性をprivate
からprotected
に変更しています。
private
にしないのは、private
にしてしまうとRuby 2.2系でwarning(private attribute?
)が出てしまう為。
Add next occur and previous occurred day of week API (#26600)
activesupport/lib/active_support/core_ext/date_and_time/calculations.rb
の修正です。
次、又は、前の曜日を取得するためのDate#prev_occurring
、Date#next_occurring
メソッドを追加しています。
Date.today # => Wed, 31 May 2017 Date.today.next_occurring(:monday) # => Mon, 05 Jun 2017 00:00:00 UTC +00:00 Date.today.next_occurring(:sunday) # => Sun, 04 Jun 2017 00:00:00 UTC +00:00 Date.today.prev_occurring(:monday) # => Mon, 29 May 2017 00:00:00 UTC +00:00 Date.today.prev_occurring(:sunday) # => Sun, 28 May 2017 00:00:00 UTC +00:00
Gemfile
、actionview/test/template/date_helper_test.rb
の修正です。
Gemfile
からmathn
を削除しています。
元々はdistance_of_time_in_words
メソッドでInteger#/
が再定義された場合も正しく動作することを確認する為にmathn
をrequireしていました。
ただ、Ruby 2.2.からdeprecateになりRuby 2.5で本体から削除され、実際のアプリケーションでmathn
をrequireして使用する事はあまり無いだろう、という事でmathn
を削除し、テストでは独自に#/
を定義し動作確認を行うようにしています。
Replace therubyracer with mini_racer
デフォルトで使用する v8 のエンジンをtherubyracer
からmini_racer
に変更しています。
therubyracer
はセキュリティ脆弱性が残っている古いバージョンに依存している為。 2013-11-12にリリースされたChrome 31と同じ状態との事です。
https://github.com/cowboyd/therubyracer/blob/master/therubyracer.gemspec#L20
なるほど古い。