2017/08/12分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
railties/CHANGELOG.md
Merge pull request #30186 from yhirano55/fix_generator_example_code
rails guideのCreating and Customizing Rails Generators & Templates
の修正です。
Generator methods
の項、lib
及びrakefile
メソッドのexampleコードが正しく動作しないコードになっていたのを修正しています。
Refactor app_generator_test (#30192)
railties/test/generators/app_generator_test.rb
の修正です。
test_default_frameworks_are_required_when_others_are_removed
にActive Storageのチェックを追加、及び、test_generator_for_yarn
に.gitignore
のチェックを追加しています。
Microsoft Azure –> Microsoft Azure Storage [ci skip]
activestorage/README.md
の修正です。
Microsoft Azure
をMicrosoft Azure Storage
に修正しています。
Evaluate @active_storage_attached_#{name}
only once
activestorage/lib/active_storage/attached/macros.rb
の修正です。
has_one_attached
、has_many_attached
メソッドで@active_storage_attached_#{name}
を取得する為のメソッドをdefine_method
を使用して定義したいのを、class_eval
を使用して定義するよう修正しています。
元の実装だとメソッドを呼び出す度にdefine_method
が評価されてしまっており無駄だった為、一度だけ評価されるようにする為にclass_eval
を使用しるよう修正しています。
Enable browser caching for blobs and variants (#30196)
activestorage/app/controllers/active_storage/blobs_controller.rb
、
activestorage/app/controllers/active_storage/variants_controller.rb
の修正です。
Active Storageのblobsとvariantsでbrowser cachingを有効にするよう修正しています。固定で5分(max-age=300, private
)設定されるようになっています。
Add null: false
to Active Storage tables
activestorage/db/migrate/20170806125915_create_active_storage_tables.rb
の修正です。
Active Storageのtableで必須の項目にnull: false
を指定しています。
Remove unused close_connection
in Action Cable tests (#30195)
actioncable/test/connection/multiple_identifiers_test.rb
、
actioncable/test/connection/string_identifier_test.rb
の修正です。
使用していないclose_connection
メソッドを削除しています。
Specify table.name
only when scope.table
and table
are different (#29058)
activerecord/lib/active_record/associations/association_scope.rb
の修正です。
scope.table
とtable
の値が違い時だけ、table.name
に値を指定するようにしています。
テーブル名と同じ名前のカラムがテーブルにある場合にエラーになるバグがあったのを避ける為。多分。
Make activestorage treat Rack::Test::UploadedFile just like ActionDispatch::Http::UploadedFile
activestorage/lib/active_storage/attached.rb
の修正です。
Active StorageのblobにRack::Test::UploadedFile
クラスのオブジェクトを指定出来るよう修正しています。テストの際に使用するよう。
Merge pull request #29720 from gaurish/ar_find_error_message_improvement
Active Recordの修正です。
idを複数指定した場合にレコードが見つからなかった場合のエラーメッセージに、見つからなかったid(e.g. Couldn't find all Developers with 'id': (1, -9999) (found 1 results, but was looking for 2). Couldn't find Developer with id -9999.
)を表示するよう修正しています。
Remove unnedded Active Storage installation steps
activestorage/README.md
の修正です。
READMEからInstallation
の項を削除しています。
Installation
項に書かれている内容は自動で行う為、との事。しかしいまはまだこのステップ必要なんですよねえ。後から不要になる想定かなあ。
Merge pull request #30113 from dixpac/remove_unecessary_require_in_test_helper
activestorage/test/test_helper.rb
の修正です。
不要なactive_storage
のrequireを削除しています。
Merge pull request #30147 from yhirano55/fix_trailing_blank_lines
activestorage/lib/active_storage/attached/many.rb
、
activestorage/lib/active_storage/service/disk_service.rb
の修正です。
ファイルの終端から不要なからファイルを削除しています。
Merge pull request #30092 from bogdanvlviv/prevent-generation-extra-empty-lines
railties/lib/rails/generators/rails/plugin/plugin_generator.rb
、
railties/lib/rails/generators/rails/plugin/templates/Rakefile
の修正です。
plugin generatorが生成するRakefile
に不要な空行が生成されないよう修正しています。
Merge pull request #30159 from allcentury/dump-temp-file-permissions
activerecord/lib/active_record/tasks/postgresql_database_tasks.rb
の修正です。
dumpファイルの移動にFileUtils.mv
を使用していたのを、FileUtils.cp
を使用するよう修正しています。元のファイルのパーミションを維持出来るようにする為。
Merge pull request #30060 from bdewater/aj-callback-docs
rails guideのActive Job Basics
の修正です。
Callbacks
の項に、メソッドを登録する場合のexampleを追加しています。
Merge pull request #30110 from yhirano55/add_git_source
railties/lib/rails/generators/rails/plugin/templates/Gemfile
の修正です。
plugin generatorが生成するGemfile
にgit_source(:github) { |repo| "https://github.com/#{repo}.git" }
の定義を追加するよう修正しています。
Merge pull request #30105 from bogdanvlviv/remove-sorted-test_order
railties/test/isolation/abstract_unit.rb
の修正です。
ActiveSupport::TestCase
にself.test_order = :sorted
の指定があったのを削除しています。
isolation testは別プロセスで動く為、test_order
の指定が無くても大丈夫な為。多分大丈夫。
Merge pull request #30116 from yhirano55/skip_unused_components_when_running_rails_command_in_plugin
railties/lib/rails/generators/rails/plugin/templates/bin/rails.tt
の修正です。
rails engineを生成する際に、skip
オプションを指定したコンポーネントのファイルはロードしないよう修正しています。
Merge pull request #30103 from yahonda/has_one_associations_failures
activerecord/test/cases/associations/has_one_associations_test.rb
の修正です。
不足していた、:authors
associationのload処理を追加しています。
Merge pull request #30114 from yhirano55/remove_empty_line_from_dummy_manifest
railties/lib/rails/generators/rails/plugin/templates/rails/dummy_manifest.js
の修正です。
dummy application用のmanifestファイルの先頭に不要な空行があったのを削除しています。
Merge pull request #29559 from kirs/eager-load-controller-actions
actionmailer/lib/action_mailer/railtie.rb
、
actionpack/lib/action_controller/railtie.rb
の修正です。
eager_loadにtrueが設定されている場合、各controllerのactionメソッドをサーバ起動時に読む込むよう修正しています。
元々は最初のリクエスト実行時に読みこむようになっていたのですが、それだと最初のリクエストのreponse timeが遅くなってしまう為、それを避ける為、サーバ起動時に読みこむようにしています。
Merge pull request #30126 from chopraanmol1/support_for_has_many_and_has_one_for_where_relation
Active Recordの修正です。
where
メソッドにhas one又はhas many associationが定義されているrelationが指定された場合、primary keyではなくforeign keyを返すよう修正しています。
例
class Account < ActiveRecord::Base
has_many :invoices
end
class Invoice < ActiveRecord::Base
belongs_to :account
end
Account.where(invoices: Invoice.where(paid: true))
# before
SELECT "accounts".* FROM "accounts" WHERE "accounts"."account_id" IN (SELECT "invoices"."id" FROM "invoices" WHERE "invoices"."paid" = 't')
# after
SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" IN (SELECT "invoices"."account_id" FROM "invoices" WHERE "invoices"."paid" = 't')
Merge pull request #30165 from tjschuck/code_formatting_fix
actionview/lib/action_view/helpers/form_helper.rb
のdocの修正です。
submit
メソッドのdocのフォーマット、グラマーの修正を行っています。
Merge pull request #30166 from yhirano55/fix_generator_method_environment
railties/lib/rails/generators/actions.rb
の修正です。
generator actionに複数行指定した場合にインデントがおかしくなってしまうバグがあったのを修正しています。
Fix outdated comment for Core::ClassMethods#===
[ci skip] (#30146)
activerecord/lib/active_record/core.rb
のdocの修正です。
Core::ClassMethods#===
のコメントを修正しています。
- # Overwrite the default class equality method to provide support for association proxies.
+ # Overwrite the default class equality method to provide support for decorated models.
def ===(object)
元のコメントはFixed that association proxies would fail === tests like PremiumSubsc…で追加されたのですが、左記のコミットで追加されたテスト(及びAssociationProxy
クラス)はSplit AssociationProxy into an Association class (and subclasses) whi…で削除されました。
で、現在は、===
メソッドはSplit AssociationProxy into an Association class (and subclasses) whi…で追加されたtest_decorated_polymorphic_where
テストで使われているから、上記のようにコメントを修正したとの事です。