なるようになるブログ

読書感想文かrailsについてかrubyについてか

rails commit log流し読み(2016/12/30)

2016/12/30分のコミットです。

CHANGELOGにのったコミットは以下の通りです。

activerecord/CHANGELOG.md

actionpack/CHANGELOG.md


Use next instead of break; avoid terminating whole loop

actionpack/lib/action_dispatch/journey/formatter.rbの修正です。

ActionDispatch::Journey::Formatter#generateメソッドでroutesを生成する際に、parameterとdefault値とチェックの行う際に、値が一致しなかった場合にbreakでループ処理全体を終了していたのを、nextで処理を継続するよう修正しています。

-            break if parameterized_parts[key].to_s != defaults[key].to_s
+            next if parameterized_parts[key].to_s != defaults[key].to_s

複数のdefaultが設定されていた場合に、途中でループを終了してしまうと他のデフォルト値に対するチェック処理が正しく行えない為、ループ処理全体は回すよう修正したようです。


Merge pull request #26977 from y-yagi/fix_26964

railties/lib/rails/commands/server/server_command.rbの修正です。

rails serverコマンドにオプションを指定するとオプションパースによるエラーでserverが起動しないバグがあったのを修正しています。


Merge pull request #27346 from utilum/core_ext_guide_duplicable

rails guideのActive Support Core Extensionsの修正です。

duplicable?メソッドについて説明している箇所に、Ruby 2.4では多くのオブジェクトでdup及びcloneが可能性である旨説明を追加、及びexampleコードを追加しています。


[ci skip] Rejigger the dublicable? wording a bit.

rails guideのActive Support Core Extensionsの修正です。

duplicable?メソッドについて説明している箇所のグラマー、言い回しの修正等を行っています。


Merge pull request #27437 from kirs/structure-load-dump-flags

Active Recordの修正です。

db:structure:loadタスク、及び、db:structure:dumpタスクで実行するコマンド(mysqldumppg_dump等)に任意のオプションを指定出来るよう対応しています。

オプションはActiveRecord::Tasks::DatabaseTasks.structure_load_flags、及び、ActiveRecord::Tasks::DatabaseTasks.structure_dump_flags経由で指定する事が出来るようになっています。


Remove try! usage in sqlite_database_tasks.

activerecord/lib/active_record/tasks/sqlite_database_tasks.rbの修正です。

structure_dumpstructure_loadメソッドでflagのパース処理でtry!メソッドを使用していたのを、使用しないよう修正しています。

Railsコード内部ではtry!は使用しないようにしたい為、との事です。ASに依存するメソッドをあまり使いたく無い為だと思います。


[ci skip] Add changelog for 261e94b.

activerecord/CHANGELOG.mdの修正です。

先のdb:structure:loadタスク及びdb:structure:dumpタスクで実行するコマンドに任意のオプションを指定出来るようにした対応について、CHANGELOGにエントリーを追記しています。


fix with_routing when testing api only controllers

actionpack/lib/action_dispatch/testing/assertions/routing.rbの修正です。

with_routingメソッドがActionController::APIの子クラスに対するテストで使用出来ないバグがあったのを修正しています。


Remove deprecated i18n scopes in Active Record

activerecord/lib/active_record/associations/has_many_association.rbactiverecord/lib/active_record/associations/has_one_association.rbの修正です。

deprecatedになっていたactiverecord.errors.messages.restrict_dependent_destroy.one及びactiverecord.errors.messages.restrict_dependent_destroy.many i18n scopeを削除しています。


Remove deprecated force reload argument in association readers

activerecord/lib/active_record/associations/collection_association.rbactiverecord/lib/active_record/associations/singular_association.rbの修正です。

deprecatedになっていたassociation readerメソッドのforce_reloadオプションを削除しています。


Set time as a timezone aware type and remove related deprecation

activerecord/lib/active_record/attribute_methods/time_zone_conversion.rbの修正です。

ActiveRecord::Base.time_zone_aware_typesのデフォルトにtime型を追加、及び、time_zone_aware_typesが設定されてない場合に出力されていたdeprecationメッセージを削除しています。


Remove deprecated support to passing a column to #quote

Active Recordの修正です。

deprecatedになっていた#quoteメソッドのcolumn引数のサポートを削除しています。


Remove deprecated name argument from #tables

Active Recordの修正です。

deprecatedになっていた#tablesメソッドのname引数のサポートを削除しています。


#tables and #table_exists? and returns only tables and not views https://github.com/rails/rails/commit/5973a984c369a63720c2ac18b71012b8347479a8

Active Recordの修正です。

#tablesメソッド、及び、#table_exists?メソッドがtableのみをリターン及びチェックするよう修正しています。

合わせて、それぞれのメソッドで出していたdeprecateメッセージをまとめて削除しています。


Remove original_exception from ActiveRecord::StatementInvalid

activerecord/lib/active_record/errors.rbactiverecord/lib/active_record/tasks/sqlite_database_tasks.rbの修正です。

deprecatedになっていた`ActiveRecord::StatementInvalid#initializeActiveRecord::StatementInvalid#original_exceptionメソッドのoriginal_exception引数を削除しています。


Raises when ActiveRecord::Migration is inherited directly.

activerecord/lib/active_record/migration.rbactiverecord/lib/active_record/migration/compatibility.rbの修正です。

migrationクラスがActiveRecord::Migrationを直接継承していた場合、エラーがraiseするよう修正しています。今後は必ずバージョンを指定(e.g. ActiveRecord::Migration[4.2])する必要があります。


Raise when a through association has an ambiguous reflection name

activerecord/lib/active_record/associations.rbactiverecord/lib/active_record/reflection.rbの修正です。

through associationで曖昧なreflection nameを指定した場合、AmbiguousSourceReflectionForThroughAssociationがraiseするよう修正しています。エラーが出るような場合、source directiveで明示的に指定する必要があります。

# before
class Author < ActiveRecord::Base
  has_many :posts
  has_many :taggings, :through => :posts
end

class Post < ActiveRecord::Base
  has_one :tagging
  has_many :taggings
end

class Tagging < ActiveRecord::Base
end
# after
class Author < ActiveRecord::Base
  has_many :posts
  has_many :taggings, :through => :posts, :source => :tagging
end

class Post < ActiveRecord::Base
  has_one :tagging
  has_many :taggings
end

class Tagging < ActiveRecord::Base
end

Rails 4.1からwarningが出るようになっていた(Ambiguous reflections are on :through relationships are no longer sup…対応がようやく削除されたようです。


Raises IrreversibleOrderError when using last with an irreversible order

activerecord/lib/active_record/relation/finder_methods.rbの修正です。

irreversible order + lastメソッドを使用した場合、ActiveRecord::IrreversibleOrderErrorをraiseするよう修正しています。


Remove deprecated support to passing a class as a value in a query

activerecord/lib/active_record/relation/predicate_builder.rbactiverecord/lib/active_record/relation/predicate_builder/class_handler.rbの修正です。

deprecatedになっていたqueryにclassを値として渡した場合の処理を削除しています。


Remove deprecated support to query using commas on LIMIT

activerecord/lib/active_record/connection_adapters/abstract/database_statements.rbactiverecord/lib/active_record/relation/query_methods.rbの修正です。

deprecatedになっていたlimitメソッドにカンマ区切りの値を指定した場合の処理を削除しています。


Remove deprecated support to passing arguments to #select when a block is provided.

activerecord/lib/active_record/relation/query_methods.rbの修正です。

deprecatedになっていた#selectメソッドにblockを渡した場合の処理を削除しています。


Remove deprecated conditions parameter from #destroy_all

activerecord/lib/active_record/relation.rbの修正です。

deprecatedになっていた#destroy_allメソッドのconditions引数を削除しています。


Remove deprecated conditions parameter from #delete_all

activerecord/lib/active_record/relation.rbの修正です。

deprecatedになっていた#delete_allメソッドのconditions引数を削除しています。


Remove deprecated #load_schema_for

activerecord/lib/active_record/tasks/database_tasks.rbの修正です。

deprecatedになっていた#load_schema_forメソッドを削除しています。


Remove deprecated #raise_in_transactional_callbacks configuration

activerecord/lib/active_record/transactions.rbの修正です。

deprecatedになっていた#raise_in_transactional_callbacksメソッド、#raise_in_transactional_callbacks=メソッドを削除しています。


Remove deprecated #use_transactional_fixtures configuration

activerecord/lib/active_record/fixtures.rbの修正です。

deprecatedになっていた#use_transactional_fixtures configurationを削除しています。


Delayed job doesn't support Active Record 5.1 yet

activejob/Rakefileの修正です。

Active JobのintegrationテストからDelayed Jobを削除sています。Delayed JobがまだActive Record 5.1をサポートしてない為、との事です。


Fix grammar in AR CHANGELOG.md [ci skip]

activerecord/CHANGELOG.mdの修正です。

#tablesメソッド及び#table_exists?メソッドがtableのみをリターン及びチェックするよう修正した対応のエントリーのグラマーの修正を行っています。


Grammar linting in activerecord/CHANGELOG.md

activerecord/CHANGELOG.mdの修正です。

各エントリーのグラマー、フォーマットの修正をまとめて行っています。


Remove deprecated #insert_sql, #update_sql, and #delete_sql

activerecord/lib/active_record/connection_adapters/abstract/database_statements.rbの修正です。

deprecatedになっていた#insert_sql#update_sql#delete_sqlメソッドを削除しています。


Remove deprecated #uniq, #uniq!, and #uniq_value

activerecord/lib/active_record/relation.rbactiverecord/lib/active_record/relation/query_methods.rbの修正です。

deprecatedになっていた#uniq#uniq!#uniq_valueメソッドを削除しています。