なるようになるブログ

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

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

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

has_and_belongs_to_manyを使用している際に、Mashal.dumpがエラーになっていたバグを修正しています。


set a constant for the "anonymous" habtm model fixes #15022

ActiveRecord::Associations#has_and_belongs_to_manyメソッドの修正です。

has_and_belongs_to_manyを設定いしているmodelをMashal.dumpするとエラーになっていたバグを修正しています。

class User < ActiveRecord::Base
  has_and_belongs_to_many :roles, class_name: 'Role', join_table: 'users_roles'
end

class Role < ActiveRecord::Base
end


Marshal.dump User.includes(:roles).first  # TypeError: can't dump anonymous class #<Class:0x00000108cd32b0>

habtm先のクラス名を保持してなかったのが問題だったようです。


add more tests around the polymorphic url api

actionview/test/activerecord/polymorphic_routes_test.rbの修正です。

polymorphic_urlメソッドのテストケースを追加しています。


[ci skip] Minor improvements on routing.md.

rails guideのRails Routing from the Outside Inページの修正です。

スペースいれたり、リンクの書き方をMarkDown方式にしたり、と細かい修正の対応をしています。


Change 'a' to 'an' [ci skip]

activesupport/lib/active_support/core_ext/hash/conversions.rbのdocの修正です。a -> anに修正。


add tests for the polymorphic_path method

actionview/test/activerecord/polymorphic_routes_test.rbの修正です。

polymorphic_pathメソッドのテストを追加しています。


add a test for classes with options

こちらもactionview/test/activerecord/polymorphic_routes_test.rbの修正です。

polymorphic_urlpolymorphic_pathメソッドにオプションがある場合のテストケースを追加しています。


don't manipulate the testclass, just add helpers to the instance

こちらもactionview/test/activerecord/polymorphic_routes_test.rbの修正です。

includeを使って@routes.url_helpersをミックスインしているのをextendに修正しています。

Test Class自体はいじらないように、オブジェクトにミックスインするようにしたのですね。


add tests for path based url_for calls

こちらもactionview/test/activerecord/polymorphic_routes_test.rbの修正です。

test_symbolメソッドでpolymorphic_pathのテストを行うよう修正しています。

また、テスト用にPolymorphicPathRoutesTestクラスを新設しています。こっちは、まだ使ってないような。