2015/06/23分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Correctly raise
ActiveRecord::AssociationTypeMismatch
when assigning a wrong type to a namespaced association. - Prevent error when using
force_reload: true
on an unassigned polymorphic belongs_to association.
Remove mistaken end from controller_path doc [ci skip]
actionpack/lib/abstract_controller/base.rb
のdocの修正です。
AbstractController::Base
のexampleに不要なend
があったのを削除しています。
rails guideのActive Record Associations
の修正です。
Single Table Inheritance
の項にあるexampleのメソッド呼び出しに()
を追加、及び生成されるSQLが実際のSQLと異なっていたのを修正していmす。
Add nodoc to the Validations::Helpers [ci skip]
activemodel/lib/active_model/validations/helper_methods.rb
のdocの修正です。
Validations::HelperMethods
moduleにnodoc
を追加しています。
Merge pull request #19431 from hmarr/head-routing
actionpack/lib/action_dispatch/journey/router.rb
の修正です。
HEAD リクエストの場合に、routingが正しくマッチしないバグがあったのを修正しています。
# routes.rb get 'is-alive-token' => 'heart_beat#index' # controller class HeartBeatController < ApplicationController def index render json: {}, status: 200 end end
上記のようなファイルがあった際にcurl -I http://127.0.0.1:3000/is-alive-token
をした場合、ActionController::RoutingError (No route matches [HEAD] "/is-alive-token")
のエラーが発生してしまうリグレッションがRails 4.2にあり、その修正の為の対応を行っています。
Explicitly ignored wildcard verbs from head_routes by tsun1215 · Pull Request #18764 · rails/rails のPRで一度対応が行われたのですが、GET
メソッドに対する考慮が足りていないという理由でrevertされてしまっており、再度の対応になります。
do not show "Failed tests" message when a failed test is not
railties/lib/rails/test_unit/reporter.rb
の修正です。
rails test
実行時、失敗したテストは無いかつスキップしたテストがあった場合に、Failed tests
というメッセージが表示されてしまっていたのを、表示されないよう修正しています。
Merge pull request #20545 from dcrec1/20541
activerecord/lib/active_record/associations/association.rb
の修正です。
associationを使用している際、そのassociationに指定しているクラスと違うクラスを指定した場合、通常ActiveRecord::AssociationTypeMismatch
クラスがraiseされるのですが、associationnにネームスペースを使用していた場合に、正しくActiveRecord::AssociationTypeMismatch
がraiseされないバグがあったのを修正しています。
issueより。
class Wheel < ActiveRecord::Base belongs_to :car end class Car < ActiveRecord::Base has_many :wheels end module Namespace def self.table_name_prefix 'namespace_' end end class Namespace::Teacher < ActiveRecord::Base has_many :apples end class Namespace::Apple < ActiveRecord::Base belongs_to :teacher end
Namespace::Apple.new(teacher: "hello") # => `ActiveRecord::AssociationTypeMismatch`になるべきが、`NameError`がおきてしまっていた
Merge pull request #20552 from jamesdabbs/belongs-to-polymorphic-force-reload
activerecord/lib/active_record/associations/singular_association.rb
の修正です。
polymorphic belongs_to association を使用している場合に、force_reload
オプションにtrue
を指定した場合に、NoMethodError
エラーが発生してしまうバグがあったのを修正しています。
issueより。
class Post < ActiveRecord::Base has_one :comment, as: :commentable end class Comment < ActiveRecord::Base belongs_to :commentable, polymorphic: true end Comment.new.commentable(force_reload: true) #=> `NoMethodError`
SingularAssociation#reader
メソッドでklassのチェック処理漏れがあった為のようで、チェック処理を追加しています。
[ci skip] correct for ActiveRecord::Associations::Preloader:
activerecord/lib/active_record/associations/preloader.rb
のdocの修正です。
ActiveRecord::Associations::Preloader
クラスのexampleで、正常に動作させるには、カラムが足りてなかったのを修正しています。
docs, add missing closing bracket. [ci skip]
activerecord/lib/active_record/associations/preloader.rb
のdocの修正です。
ActiveRecord::Associations::Preloader
クラスのexampleで、コードに閉じカッコが足りてない箇所があったのを修正しています。