なるようになるブログ

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

rails commit log流し読み(2014/05/17)

2014/05/17分のコミットです。

CHANGELOGにのったコミットは以下の通りです(詳細は本文参照)。

actionview/CHANGELOG.md

  • Allow custom asset host to be passed in asset_url

activerecord/CHANGELOG.md

  • Restrict deletion of record when using delete_all with uniq, group, having or offset.
  • Add support for counter name to be passed as parameter on CounterCache::ClassMethods#reset_counters.

activesupport/CHANGELOG.md

  • Fixed ActiveSupport::Subscriber so that no duplicate subscriber is created when a subscriber method is redefined.

fixed a typo [ci skip] https://github.com/rails/rails/commit/812b4e88b753e50a0d91d6fa5bd6f24ff018b47c

actionpack/lib/abstract_controller/url_for.rbの修正です。

エラーメッセージにドットを追加しています。


Document conflicts in db/schema.rb [ci skip] https://github.com/rails/rails/commit/b48bc869fa55a1b4622ca316a9b62b6da901402f

rails guideのActive Record Migrationsのページの修正です。

db/schema.rb がコンフリクトした場合の対応について記述を追加しています。因みに、手動でコンフリクトを解決しての、との事。


Remove code related to adapter which are no longer in repo

activerecord/Rakefileの修正です。

現状対応していないDB Adapterの記述を削除しています。

削除されたのは、firebird、frontbase、sybaseです。


Our test suite isn't ready to run in random order yet :cry: Gemfileの修正です。minitestのバージョンを5.3.4以下に指定しています。

minitestでtest suiteがランダムに実行されるようになったようです。コミットはこちら

で、railsがまだランダムに実行されるのに対応してないので、バージョンの指定をした、という事のようです。

minitestのこの修正、また影響が大きそうな…。


Merge pull request #15021 from hubertlepicki/allow_custom_host_in_asset_url

actionview/lib/action_view/helpers/asset_url_helper.rbの修正です。

asset_urlメソッドhostオプションを渡した場合、config.action_controller.asset_host の値を上書きするよう修正しています。

asset_url "application.js"                                 # => http://example.com/application.js
asset_url "application.js", host: "http://cdn.example.com" # => http://cdn.example.com/javascripts/application.js

CDN使用する場合に重宝しそう。


Add a specific method to force the transaction record state clear

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

昨日行われたトランザクション処理のリファクタリングを更に修正しています。

よく呼ばれる処理については手を入れず、追加部分については別メソッドにしています。


Missed if :bomb:

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

上のコミットでifが漏れてしまっていたので、追加しています。


Reuse the force_clear_transaction_record_state

こちらもactiverecord/lib/active_record/transactions.rbの修正です。

追加したforce_clear_transaction_record_stateメソッドを違う箇所でも使用するよう修正しています。


prepend mutates the string so we can remove the assignment

activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rbの修正です。

不要な代入処理を削除しています。


Remove the assignment for real this time.

activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rbの修正です。

こちらも不要な代入処理の削除。


Remove unecessary require

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

不要なrequire 'thread'を削除しています。


remove trailing whitespace. [ci skip]

guides/source/caching_with_rails.md及びguides/source/upgrading_ruby_on_rails.mdの修正です。

不要なスペースの削除。


doc, pg hstore and json columns are mapped as Hash. [ci skip]

rails guideのA Guide for Upgrading Ruby on Railsの修正です。

PostgreSQLhstorejsonを使用した場合、Hashマッピングされる旨説明を追加しています。


Generate the cookies_serializer configuration with :marshal when upgrading

railties/lib/rails/generators/rails/app/app_generator.rbの修正です。

rails 4.0-からアップグレードする際に、cookies_serializerの設定を作成するようのメソッドを追加しています。

なお、デフォルト値は:marshalになっています。互換性を考慮して、との事です。:hybridだと動かないケースがあるもよう。


foo :bomb:

railties/lib/rails/generators/rails/app/app_generator.rbの修正。

変数名をfooとしていたのを修正しています。


Merge pull request #15071 from leafac/issues/11985

ActiveRecord::Relationの修正です。

特定のメソッドと合わせてdelete_allを使用した際に、ActiveRecordErrorをraiseするよう修正しています。

対象メソッドは、:limit, :distinct, :offset, :group, :havingです。

Todo.uniq.delete_all # ActiveRecord::ActiveRecordError: delete_all doesn't support distinct

元々は動いていたのですが、処理的に矛盾が無いようにエラーとするよう修正したようです。


Add CHANGELOG entry for #15071 [ci skip]

上記delete_allの仕様変更について、CHANGELOGに追記しています。


Merge pull request #15037 from roccoblues/fix_duplicate_activesupport_subscribers

activesupport/lib/active_support/subscriber.rbの修正です。

ActiveSupport::Subscriberを継承したクラスでメソッドの再定義を行った際に、同じsubscriberを複数登録してしまうバグがあったのを修正しています。

4.1.0から壊れていたもよう。


Replace first person point of view on guides.

複数のrails guiden修正です。

一人称視点になっていた記述を修正した、かと。


Updates reset_counters to allow counter name in params

CounterCache::ClassMethods#reset_countersメソッドの修正です。

reset_countersメソッドの第二引数は元々アソシエーション名のみ指定可能だったのを、counter nameも指定出来るよう修正しています。

counter nameというのは、counter cacheに使用するカラム名の事だと思うのですが、試した感じだと上手く動かない…。


Fix typo in CHANGELOG entry for #15071

activerecord/CHANGELOG.mdの修正。

I -> Inに修正。


fixed capitalizations [ci skip]

guides/code/getting_started/Gemfileの修正です。

sqlite3 -> SQLite3に修正等、小文字を大文字に修正。


fix typo [ci skip]

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

docのtypoの修正です。


prefer file name instead of filename [ci skip]

rails guideのAPI Documentation Guidelinesのページの修正です。

FilenamesFile Namesに修正。


Ensure :js is defined regardless of the outcome of the test.

actionpack/test/abstract/collector_test.rbの修正です。

テストの中でAbstractController::Collector.send(:remove_method, :js)を行っているのですが、既にメソッドが削除済みの場合、NameErrorが起こってしまうので、ensure追加して、メソッドが無い場合にメソッド追加するよう対応しています。


fix symbol

rails guideのGetting Started with Railsページの修正です。

. -> :に修正しています。