2年越しのバグが修正されたたり、routing error画面の修正が入ったり、割と盛りだくさん。
個人的には、asset precompileの設定がinitializerに移動した修正が嬉しいえす。
Fix error for aggregate methods with select, see issue #13648
select
メソッドと一緒にaggregate methods(empty?, any?, count) を呼び出し際に、rails4.1からエラーになっていたのを、エラーにならないよう修正しています。
具体的には以下のような感じですね。
posts = Post.select(:title, :body) posts.count # ここでエラー
select
で複数カラム指定している状態でCOUNTを呼び出しているので、SQLの構文エラーになります。
Postgreだと下記エラーがおきます。
ActiveRecord::StatementInvalid: PG::UndefinedFunction: ERROR: function count(integer, character varying) does not exist
SQL的に考えると正しい動きのような気もしますが、rails 4.0.xまでは正常に動いていたようなので、動くよう処理を直しています。
[追記]count
を呼び出した際にSQL構文エラーになるのは変わらないのですが、aggregate methods(empty?, any?, count) でエラーにならないよう、対応、が正しいです。なので、size
だと正常に値が取得出来ます。[/追記]
Merge pull request #11656 from emre-basala/xml_mini_test
ActiveSupport:XmlMini#to_tag
のテストコードを追加しています。
コードの追加のコミットが見当たらないと思ったら、9ヶ月までに作られたPRでした。
Require action_controller before any other action_controller file
action_controller
クラスのrequireを他のaction_controller
ファイルより先に行うよう修正しています。
sass-railsの方で、テストが動かない問題が起きてたらしく、その為の対応。
不要なsend
メソッドの削除。
Merge branch 'rm-uuid-fixtures'
fixtureでデータを作成する際、columnがuuid
型だった場合に、自動でUUID形式のデータを作成するよう対応しています。
UUIDについてはwiki参照。
UUID型を提供しているRDMSはPostgresだけなので、今のところ影響があるのはPostgresだけです。
Remove warning of unused variable
使用してない変数の削除。
Add after_commit/after_rollback to callback list
rails guideの修正。 Active Record Callbacksのlistにafter_commit/after_rollback
が含まれていなかったのを追加しています。
after_commit/after_rollback
が入ったの大分前なので、長らく放置されていたのですね。
ci skip Remove false documentation
こちらもrais guideの修正。redefine_method
に関する説明を修正しています。
Merge pull request #12829 from iantropov/issue_insert_via_hmt_scope_3548
has_many :through
associationをscope付きで使った場合に、レコードが保存されないバグの修正。
issueでは以下のようになっています。
has_many :developers, :through => :project_users, :source => :user, :conditions => {:project_users => {:role => :developer}} @project.developers << @user # Results in: INSERT INTO "project_users" ("created_at", "project_id", "role", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["created_at", Mon, 07 Nov 2011 10:37:00 UTC +00:00], ["project_id", 1], ["role", nil], ["updated_at", Mon, 07 Nov 2011 10:37:00 UTC +00:00], ["user_id", 1]] @project.developers # Returns the user from @user @project.reload @project.developers # Returns an empty array
issue作成されたのが2年以上前なので、大分昔からあるバグだったんですねえ。
docs, make association autosave: true
examples runnable. Closes #14700
activerecord/lib/active_record/autosave_association.rb
のdocの修正です。割と致命的に誤っていて、exampleが全く動いかたないモノになっていたようです。
Minor fixes in the rails debugging guide
rails guideの修正。typoの修正です。いつのまにか、debug用gemの説明がbyebugになっているんですね。気付かなかった。
PostgreSQL, adapter automatically reloads it's type map. Closes #14678.
識別出来ないOIDがあった場合に、自動的に再読み込みを行うよう修正しています。
Enum型を使った場合に発生していたらしい。
PostgreSQL, warn once per connection per missing OID. Closes #14275.
識別出来ないOIDがあった際に、OIDを生成して、warningが一回しか出ないよう対応しています。
Implement fuzzy matching for route search on routing error html page.
routing error画面の修正。
Path検索画面で、あいまい検索の改善を行っているようです。
Improve CSS styling for routing error html page.
こちらもrouting error画面の修正。cssの改善を行っています。
Split search results into 'exact matches' and 'fuzzy matches'.
これもrouting error画面の修正。pathの検索結果の改修を行っているようです。
Only make deeply nested routes shallow when parent is shallow
shallow: true
した場合、nestしたroutesが生成されないのですが、親もshallow : true
になっている場合、nestしたroutesが生成されるように修正されています。
Re-review the debugging guide.
rails guideの修正。debugging guideの説明を修正しています。
Add more test case for #demodulize, Improve documentation
ActiveSupport::Inflector.demodulize
についてのテストコードの追加及びドキュメントの改善です。
ActiveSupport::Inflector.demodulize
自体、初めて知りました。
assert_equal "Account", ActiveSupport::Inflector.demodulize("MyApplication::Billing::Account") assert_equal "Account", ActiveSupport::Inflector.demodulize("Account") assert_equal "Account", ActiveSupport::Inflector.demodulize("::Account")
module部分を除いたクラス名をstringで返すメソッドなんですね。
Move assets precompile (and version) to an initializer
assets precompileの設定をinitializerに移動しています。
staging/productionで同じ設定をしたい場合に、それぞれにassets precompileの設定を書いていたので、個人的にこれは嬉しい修正です。地味に下位非互換な気もします。
Be explicit about allowed constraint values, fixes #14702
rails guideの修正。constraints
を使用した際の説明を追記しています。