ビューで「どのテンプレートを呼び出 しているか」が HTML コメントで表⽰ できるようになった .annotate_template_file_names annotates HTML output with template names by joelhawksley · Pull Request #38848 · rails/rails Add the configuration option for annotating templates with file names to the generated app by prathamesh-sonpatki · Pull Request #39204 · rails/rails 9
↓ のように書く # config/routes.rb Rails.application.routes.draw do draw(:admin) end # config/routes/admin.rb get :foo, to: 'foo#bar' routes.rb が⼤量にあって、かつ分けやすい箇所がある(ex: 管理画⾯、 API) のであれば試してみるとよいのでは 13
6.0 のときと同じようにconnected_to でDB を切り替える ActiveRecord::Base.connected_to(shard: :default) do @id = Record.create! # デフォルトのshard のDB でレコードを作成する end ActiveRecord::Base.connected_to(shard: :shard_one) do Record.find(@id) # もう⼀つのshard からfind しているのでレコードは⾒つからない end role とshard を⼀度に両⽅切り替えることもできる ActiveRecord::Base.connected_to(role: :reading, shard: :shard_one) do Record.first end 23
deprecated で例外を発⽣させる設定をデフォルトにしたんだけど、こ こはまだdeprecated なメソッドを使いたい、というようなときには明 ⽰的にそれを許可することもできる。 ActiveSupport::Deprecation.allow do User.do_thing_that_calls_bad_and_worse_method end 引数で許可するものを絞り込むこともできる ActiveSupport::Deprecation.allow [:bad_method, "worse_method"] do User.do_thing_that_calls_bad_and_worse_method end 27