なるようになるブログ

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

rails commit log流し読み(2016/07/04)

2016/07/04分のコミットです。

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

actioncable/CHANGELOG.md


Merge pull request #25241 from aguynamedben/fix-touch-error-messages

activerecord/lib/active_record/persistence.rbactiverecord/lib/active_record/touch_later.rbの修正です。

touchメソッドでエラーになった際に、より詳細なエラーの情報を出力するよう修正しています。

# before
User.new.touch
# => ActiveRecord::ActiveRecordError: cannot touch on a new record object

# after
User.new.touch
# => ActiveRecord::ActiveRecordError: cannot touch on a new or destroyed record object. Consider using persisted?, new_record?, or destroyed? before touching

Merge pull request #25030 from mmmpa/pull_request

actioncable/lib/action_cable/subscription_adapter/subscriber_map.rbの修正です。

SubscriptionAdapter::SubscriberMap#broadcastでbroadcastの対象となるsubscriberを取得する際に、対象のsubscriberが既にchannelをremove済みでないかどうかチェックするよう修正しています。


Merge pull request #24988 from mwear/action_cable_broadcast_notifications

actioncable/lib/action_cable/server/broadcasting.rbの修正です。

Broadcaster#broadcastメソッドを実行する際に、ActiveSupport::Notificationsのhook処理を行うよう修正しています。keyはbroadcast.action_cableです。


Merge pull request #25663 from vipulnsward/updated-syntax-highlighter

Rails guideの修正です。

Rails guideで使用しているSyntaxHighlighterのバージョンをv3からv4にあげています。古い SyntaxHighlighterだとページからのコピペが上手く動かないケースがあった為のようです。


Pathname might not be always initialized.

activesupport/test/testing/file_fixtures_test.rbの修正です。

不足していたpathnameのrequireを追加しています。


Fixed unnecessary nesting in handle_dependency

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

ActiveRecord::Associations::HasManyAssociation#handle_dependencyメソッド内のcase / whenを使ってdependent毎に処理分岐をしている箇所で、最後のelseの中で更にdependentの値を見て処理分岐をしていたのを、whenの分岐自体を追加し、elseの中での分岐を削除しています。

+        when :destroy
+          # No point in executing the counter update since we're going to destroy the parent anyway
+          load_target.each { |t| t.destroyed_by_association = reflection }
+          destroy_all
         else
-          if options[:dependent] == :destroy
-            # No point in executing the counter update since we're going to destroy the parent anyway
-            load_target.each { |t| t.destroyed_by_association = reflection }
-            destroy_all
-          else
-            delete_all
-          end
+          delete_all

fix respond_to? documentation

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

respond_to?メソッドのdoc内のexampleコードがrespond_to'になっていたのを、respond_to?`に修正しています。


Tiny documentation fixes [ci skip]

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

tagメソッドのdocのフォーマットの修正を行っています。