なるようになるブログ

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

rails commit log流し読み(2015/01/19)

2015/01/19分のコミットです。

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

activerecord/CHANGELOG.md


Include stackprof on ruby 2.2 as well as 2.1

Gemfileの修正です。

Ruby 2.2でもstackprofを使用するよう修正しています。


Use bundler 1.7 on travis

.travis.ymlの修正です。

Travisでテストを実行する際、最新のbundlerを使用するようbefore_scriptでgem install bundlerを実行するよう修正しています。


Don't calculate in-place changes on attribute assignment

activemodel/lib/active_model/dirty.rbactiverecord/lib/active_record/attribute_methods/dirty.rbの修正です。

save_changed_attributeメソッド内でのattributeが変更されたかどうかのチェックにattribute_changed?ではなく、attribute_changed_by_setter?を使用するよう修正しています。

attribute_changed?の延長で適切な箇所での変更をチェックする処理が行われていたのですが、これは重い処理、かつ、attributeに直接値を設定した場合は不要、との事で行わないよう修正したようです。


Should escape regexp wildcard character .

ActiveRecordのテストの修正です。

assert_matchでテストを行ってる箇所で、正規表現を使用する際、"."をエスケープせずに使用している箇所があったのを、"\"でエスケープするよう修正しています。

エスケープ無しだとwildcardになってしまって、一文字なら何でもマッチしてしまうからですね。


Remove unused accessor

activerecord/test/cases/migration/column_positioning_test.rbの修正です。

使用していないtable_name accessorを削除しています。


Merge pull request #18501 from prathamesh-sonpatki/nosql

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

update_attributeを、値の変更があった場合のみクエリーを発行するよう修正しています。値が変わってない場合に、不要なクエリーを発行しないようにする為、との事です。


Fix name_for_action in routing

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

resourceオプションのasオプションに空文字を指定した場合に、rake routesの実行結果に不要な"_"が付与されてしまっていたのを修正しています。

Rails.application.routes.draw do
  resource :user, as: ''
end
$ rake routes
# 4.2
  new_ GET    /user/new(.:format)  users#new
 edit_ GET    /user/edit(.:format) users#edit

# 4.1.9
   new GET    /user/new(.:format)  users#new
  edit GET

present?のチェックを追加して対応しています。


Merge pull request #18380 from nobu/Use-EXEEXT

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

RbConfig::CONFIG['host_os']Windows(mswin|mingw)の場合にコマンド名に".exe"を追加していたのを、RbConfig::CONFIG['EXEEXT']を使用するよう修正しています。

-      commands += commands.map{|cmd| "#{cmd}.exe"} if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
+      unless (ext = RbConfig::CONFIG['EXEEXT']).empty?
+        commands = commands.map{|cmd| "#{cmd}#{ext}"}
+      end

Fix wording in AR CHANGELOG about time columns change [ci skip]

activerecord/CHANGELOG.mdの修正です。

time columnsに関する対応について、グラマーの修正を行っています。


Use force: true options for creating tables in bug templates

guides/bug_report_templates/active_record_gem.rbguides/bug_report_templates/active_record_master.rbの修正です。

バグ報告用テンプレートで、tableを作成する際にforce: trueするよう修正しています。同じテーブルがあった時の為に、なんですが、in memoryのdatabaseなので、同じテーブルがある、というケースは無さそうな気もするのですが…。


fix typo in number_field_tag documentation [ci skip]

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

number_field_tagメソッドexampleの実行結果にタイポがあったのを修正しています。


Merge pull request #18450 from tonytonyjan/patch-1

activesupport/lib/active_support/core_ext/numeric/time.rbの修正です。

active_support/core_ext/date/acts_likeのrequireを追加しています。