2017/02/22分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Prefer
remove_methodoverundef_methodwhen reloading routes - Add the
resolvemethod to the routing DSL - Add the
directmethod to the routing DSL
Tiny documentation edits [ci skip]
actionpack/lib/action_dispatch/system_test_case.rbのdoc及びrails guideのA Guide to Testing Rails Applicationsの修正です。
グラマー及びフォーマットの修正を行っています。
Only load SystemTestCase if Capybara is defined
railties/lib/rails/test_help.rbの修正です。
Capybaraが定義されている場合のに、ActionDispatch::SystemTestCaseクラスを読み込むよう修正しています。
Revert back to the original of using package.json in the root of the project (#28093)
railtiesの修正です。
vendor配下で管理されるようになっていたpackage.json及びnode_modulesを、vendor配下ではなくproject root配下で管理するよう戻しています。既に多くのエコシステムがrails rootでpackage.json及びnode_modulesを管理するようになっており、合わせた方が混乱が少ないだろう、という理由により戻したようです。
actionmailer/CHANGELOG.mdの修正です。
定数をバッククォートで囲むよう修正しています。
各ファイルで、リリース済みのarelを使用するよう修正しています。
actionmailer/CHANGELOG.mdの修正です。
コマンドをバッククォートで囲むよう修正しています。
activejob/CHANGELOG.mdの修正です。
CHANGELOGのエントリー間にあった不要なスペースを削除しています。
Fix schema leakage from dirty_test.rb
activerecord/test/cases/dirty_test.rbの修正です。
filedという名前のカラムを作成した場合のテストの後処理で、DBのcacheをclearするよう修正しています。clearしないと不要なカラムの除法を保持したままになってしまうため。
Add backticks around method names
activerecord/CHANGELOG.mdの修正です。
メソッド名をバッククォートで囲むよう修正しています。
Merge pull request #23138 from rails/custom-url-helpers-and-polymorphic-urls https://github.com/rails/rails/commit/f3d729f75363136f659f2cb78165ca5c899ecfe7
Action Packの修正です。
routesに関する改善がまとめて含まれています。まず、routesファイルで直接custom url helpersを作成出来るdirectメソッドが追加されています。
例。
# routes.rb Rails.application.routes.draw do direct :homepage do "http://www.rubyonrails.org" end direct :commentable do |model| [ model, anchor: model.id ] end direct :main do { controller: 'pages', action: 'index', subdomain: 'www' } end end
irb(main):004:0> app.homepage_url # => "http://www.rubyonrails.org" irb(main):001:0> app.commentable_url(User.first) # => "http://www.example.com/users/298486374#298486374"
次に、routesファイルでmodelのpolymorphic mapping をカスタマイズする為のresolveメソッドが追加されています。
# routes.rb Rails.application.routes.draw do resource :basket resolve "Basket" do [:basket] end end
上記のように定義した場合、link_toやform_forにBasketクラスのインスタンスを渡した場合、/baskets/:idというURLではなく、/basketというURLが生成されるようになっています。
最後に、routesをreloadした際に、undef_methodではなくremove_methodメソッドを使用するよう修正しています。親クラスに同名のメソッドが定義されていた場合に、そちらのメソッドは引き続き呼べるようにするためのようです。
[ci skip] Fix typos in direct/resolve changelog.
actionpack/CHANGELOG.mdの修正です。
先ほどコミットされたresolve、directメソッドの対応のentryにタイポがあったのを修正しています。
[ci skip] Fix direct/resolve documentation.
actionpack/lib/action_dispatch/routing/mapper.rbのdocの修正です。
resolve、directメソッドのdocにタイポ及びフォーマットの修正を行っています。
Merge pull request #28042 from kamipo/add_changelog_for_27384
activerecord/CHANGELOG.mdの修正です。
整数型のPKがauto incrementになった対応(Tweak bigint PK handling、Correctly dump integer-like primary key with default nil)について、CHANGELOGのエントリーを追加しています。
Merge pull request #28095 from matthewd/nested-database-config
activerecord/lib/active_record/connection_adapters/connection_specification.rbの修正です。
DB configファイルに3階層目を定義出来るよう修正しています。
例。
default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
primary:
<<: *default
database: db/development.sqlite3
readonly:
<<: *default
database: db/readonly.sqlite3
上記のように、environment配下に更に定義を追加出来るようになっています。
[doc] Fix wrong class name in testing.md
rails guideのA Guide to Testing Rails Applicationsの修正です。
Implementing a system testの項のexampleコードのクラス名に誤りがあったのを修正しています。
remove needless extension from system test example [ci skip]
rails guideのA Guide to Testing Rails Applicationsの修正です。
System Testクラスをgenerateする場合のexampleに不要な拡張子があったのを削除しています。
Preload to_datetime before freezing a TimeWithZone instance
activesupport/lib/active_support/time_with_zone.rbの修正です。
TimeWithZoneのインスタンスをfreezeする際に、to_datetimeメソッドの結果もcacheするよう修正しています。
def freeze - period; utc; time # preload instance variables before freezing + # preload instance variables before freezing + period; utc; time; to_datetime super end
freezeメソッド呼び出し後にto_datetimeメソッドが呼び出せるようにする為。
Add CHANGELOG entry for #28104
activesupport/CHANGELOG.mdの修正です。
直前のfreezeにto_datetimeメソッドの結果をcacheするようにした対応について、CHANGELOGのエントリーを追加しています。
activesupport/test/json/encoding_test_cases.rbの修正です。
不足していたdate、time等のrequireを追加しています。
Bundler 1.14.5でrubygems/spec_fetcherがlazy loadされるようになり、その影響で、元々はrequireされていたファイルがrequireされなくなった為、requireを追加したとのことです。
参考:Defer requiring rubygems/spec_fetcher until it becomes necessary · bundler/bundler@a78583c
Bump removal of /:controller/:action to Rails 5.2
actionpack/lib/action_dispatch/routing/route_set.rbの修正です。
Rails 5.1で削除予定だったroutes.rbのpath parametersに:controller、:actionを指定した場合の処理の削除を、Rails 5.2に削除するようdeprecateメッセージを変更しています。
if route.segment_keys.include?(:controller)
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Using a dynamic :controller segment in a route is deprecated and
- will be removed in Rails 5.1.
+ will be removed in Rails 5.2.
MSG
end
単純に対応が間に合わなかったからですかねえ。
actionpack/test/controller/live_stream_test.rb、
activesupport/test/core_ext/string_ext_test.rbの修正です。
不足していたtimeoutのrequireを追加しています。こちらもBundler 1.14.5の対応の影響。