2014/12/31分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Ensures that primary_key method will return nil when multi-pk
- Fix error message when trying to create an associated record
activejob/CHANGELOG.md
Remove single space response body for head request
actionpack/lib/action_controller/metal/head.rb
の修正です。
head
メソッドを使用した際に、response bodyにシングルスペースを出力していたのを、シングルスペースを含まないよう修正しています。
元々、Safariのバグの対策の為にシングルスペースを出力していたのですが、現状問題無いとの事で削除しています。同様の対応が以前render
メソッドでは行われていたのですが、head
の方は対応が漏れてしまっていたようです。
ActiveJob testing improvements
ActiveJobの修正です。
- Test用のadapterがserialize/deserialize処理を行ってたのを行うよう修正
- ActiveJobの標準のテストでTest用のAdapterを使うよう修正
activejob/lib/active_job/test_helper.rb
に'active_support/core_ext/hash/keys'を追加
を行っています。
Merge pull request #18130 from claudiob/better-record-identifier-doc
actionview/lib/action_view/record_identifier.rb
のdocの修正です。
ActionView::RecordIdentifier
moduleのexample、説明の追加を行っています。
Use more semantic method to check password
activemodel/lib/active_model/secure_password.rb
の修正です。
authenticate
メソッドでパスワードのチェック処理にis_password?
メソッドを使うよう修正しています。
Tiny documentation fixes [ci skip]
actionview/lib/action_view/record_identifier.rb
、
activerecord/lib/active_record/locking/optimistic.rb
のdocの修正です。
typoの修正、説明に改行の追加等を行っています。
Fix description for application_name method - change simple to simply
railties/lib/rails/generators/named_base.rb
のdocの修正です。
simple
-> simply
に修正しています。
Remove this line which was added by accident [ci skip]
rails guideのA Guide to Testing Rails Applications
の修正です。
誤って追加してしまった行を削除しています。
Ensures that primary_key method will return nil when multi-pk
activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
の修正です。
複数主キーを使用している場合、primary_key
メソッドがnilを返すよう修正しています。
Replace exhaustive list of helper methods with pointers to helper classes found
rails guideのA Guide to Testing Rails Applications
の修正です。
integration test用のhelperメソッドの一覧が記載されていたのを削除し、各API docへのリンクを追加しています。
Add implement integration test to Testing Guide. [ci skip]
Implementing an integration test
セクションを追加しています。
integration testのgenerateから実際のテストコードの作成までの一連の説明について記載しています。
Update CHANGELOG entry for #18070 [ci skip]
activerecord/CHANGELOG.md
の修正です。先に行われたprimary_key
メソッドの対応の説明を改善しています。
Make "Testing Views" separate section, move "Setup and Teardown" into
rails guideのA Guide to Testing Rails Applications
の修正です。
setup/teardownの説明をfunctional testing
セクションに移動しています。
Move request tests after functional and before views, and move helper tests
rails guideのA Guide to Testing Rails Applications
の修正です。
Testing Routes
セクションをfunctionalテストについての説明の後ろに、Testing helpers
セクションをTesting Views
セクションの後ろに、それぞれ移動しています。
Add result of running articles_routes_test and point to more information for
rails guideのA Guide to Testing Rails Applications
の修正です。
controllerテストのexampleの実行結果の追加、及びActionDispatch::Assertions::RoutingAssertions
のAPI docへのリンクを追加しています。
Replace exhaustive list of methods with pointer to API docs. [ci skip]
rails guideのA Guide to Testing Rails Applications
の修正です。
ActiveJobのテスト用ヘルパーメソッドの一覧が記載されていたのを削除し、API docへのリンクを追加しています。
The Guide to Testing Rails Applications is published! :tada: :tada: [ci skip]
guides/source/documents.yaml
の修正です。
A Guide to Testing Rails Applications
からwork_in_progress: true
を削除、及びdescriptionの修正を行っています。これで正式にTesting Guideが公開状態になっています。
Fix comment typo in debugger.rb
activesupport/lib/active_support/core_ext/kernel/debugger.rb
の修正です。
debugger
メソッドのコメントにあったタイポを修正しています。
Fixes simple missprint in docs for #cyle in text_helper
actionview/lib/action_view/helpers/text_helper.rb
のdocの修正です
simple_format
メソッドのexampleに誤りがあったのを修正しています。
Move Engines guide under Extending Rails [ci skip]
guides/source/documents.yaml
の修正です。
Getting Started with Engines
guideをCreating and Customizing Rails Generators
guideの下に移動しています。
Merge pull request #17680 from larskanis/fix_bytea_change_detection
activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb
の修正です。
Bytea#type_cast_from_database
の引数に渡された値がType::Binary::Data
クラスだった場合、PGconn.unescape_bytea
を行わないよう修正しています。
pg gemの0.18.0側の挙動変更に合わせての対応との事です。
Raise a better exception for renaming long indexes for mysql adapters
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
の修正です。
MySQL adapterで、名前が長すぎてindex名の変更に失敗した場合のエラーメッセージを、より分り易い内容に修正しています。
Share foreign_key_present? implementation in has associations
ActiveRecordのassociationsの修正です。
HasOneAssociation
クラスでforeign_key_present?
メソッドを使用出来るよう修正しています。
foreign_key_present?
が呼び出せない事で、has_one
associationとhas_many
associationで挙動が異なってしまった箇所があったので修正したとの事です。以下サンプル。
class User < ActiveRecord::Base has_one :review has_many :posts end class Post < ActiveRecord::Base belongs_to :user end class Review < ActiveRecord::Base belongs_to :user end user = User.create! user.posts << Post.create! user.review = Review.create! # This queries the database User.new(id: user.id).posts # => [Post<id: 1>] # This does not query the database User.new(id: user.id).review # => nil
use methods on the request rather than direct hash access
actionpack/lib/action_controller/metal/url_for.rb
、
actionpack/lib/action_dispatch/http/request.rb
の修正です。
env
Hashから値を取得していたのを、request
のメソッドを使用するよう修正しています。
stop referencing env
in url_for
actionpack/lib/action_controller/metal/url_for.rb
、
actionpack/lib/action_dispatch/http/request.rb
の修正です。
url_for
メソッドでenv
Hashから値を取得していたのを、request
オブジェクトのメソッドを使用するよう修正しています。
ActiveJob: delegate full deserialization to class
activejob/lib/active_job/core.rb
の修正です。
ActiveJob::Base.deserialize
メソッド内で行っていたdeserialize処理をjob classにdelegateするよう修正しています。
これにより、Job Dataのdeserialize時に任意の処理を行えるようになりました。以下例。
class DeliverWebhookJob < ActiveJob::Base def serialize super.merge('attempt_number' => (@attempt_number || 0) + 1) end def deserialize(job_data) super(job_data) @attempt_number = job_data['attempt_number'] end rescue_from(TimeoutError) do |ex| raise ex if @attempt_number > 5 retry_job(wait: 10) end end
これは割と便利そうですねえ。
Fix error message when trying to create an associated record
activerecord/lib/active_record/relation.rb
の修正です。
association recordを作成しようとした際に、外部キーが見つからなかった場合のエラーメッセージを修正しています。
# before NoMethodError: undefined method `val' for #<Arel::Nodes::BindParam:0x007fc64d19c218> # afer ActiveRecord::UnknownAttributeError: unknown attribute 'foreign_key' for Model.
Extract the index length validation to a auxiliar method
activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
の修正です。
index長をチェックするメソッド(validate_index_length!
)を新規に作成し、rename_index
メソッドでそのメソッドを使用するよう修正しています。
Add Profiling guide skeleton [ci skip]
i
guides/source/documents.yaml
、
guides/source/profiling.md
の修正です。
Profiling Rails Applications
guideのスケルトンを作成しています。楽しみ。
Update Getting Started guide to reflect foreign key in migration [ci skip]
rails guideのGetting Started with Rails
の修正です。
Adding a Second Model
セクションのexampleにforeign keyのマイグレーションを追加しています。
ActiveJob is not ActionJob [ci skip] :smile:
activejob/lib/active_job/queue_adapter.rb
のdocの修正です。
"ActionJob" -> "ActiveJob"にタイポの修正をしています。
Fix spell life cycle on activejob docs [ ci skip]
activejob/lib/active_job/callbacks.rb
、
`guides/source/active_job_basics.mdの修正です。
"lifecycle" -> "life cycle"にタイポの修正をしています。
fix rake command typo in Testing guide [ci skip]
rails guideのA Guide to Testing Rails Applications
の修正です。
rake コマンドをタイポしている箇所があったのを修正しています。