2015/04/09分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
Allow AS::Cache::FileStore#clear without cache directory
activesupport/lib/active_support/cache/file_store.rb
の修正です。
ActiveSupport::Cache::FileStore#clear
メソッド全体にrescue Errno::ENOENT
を追加し、clear対象のファイル・ディレクトリが存在しない場合にエラーにならないよう修正しています。
新規にrailsのアプリをクローンした場合等、clear対象のファイル・ディレクトリが無い場合があり、その際にエラーにならないよう対応したとの事です。
Fix uniqueness validation with out of range value
activerecord/lib/active_record/validations/uniqueness.rb
の修正です。
build_relation
メソッドでRangeError
をrescueし、none
を返すよう修正しています。
class A < ActiveRecord::Base PG_MAX_INT = 2147483647 validates :number, uniqueness: true, inclusion: { 0..PG_MAX_INT } end a = A.create(number: (A::PG_MAX_INT + 1))
# before RangeError: 2147483648 is out of range for ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer with limit 4 # after a.errors[:number] => ['is not included in the list']
カラムにinteger型等を使用し、その型の最大値以上の値を指定した場合に、RangeError
がそのままアプリ側にthrowされてしまっていた為、他のvalidation エラー同様errors
で値を参照出来るようにする為に修正したようです。
ActiveRecordの修正です。
belongs_to associationを使用している場合に、複数レコードに対するtouch
処理が一度だけ行われるよう修正しています。
class LineItem < ActiveRecord::Base belongs_to :invoice, :touch => true end
class Invoice < ActiveRecord::Base has_many :line_items, :autosave => true end
line_item = LineItem.create!(amount: 1) line_item2 = LineItem.create!(amount: 2) Invoice.create!(line_items: [line_item, line_item2]) # `touch`処理は一度だけ行われる LineItem.transaction do line_item.touch line_item2.touch end # transaction処理が無い場合、通常通り2回 line_item.touch line_item2.touch
無駄なqueryが発行されないように、との事で改善したようです。コミットログにAdd more tests and small method rename
とあるので、もう少し改善が入りそうな感じです。
fix documentation for SchemaStatements#add_foreign_key
activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
のdocの修正です。
foreign keyの名前がRails 4.2.0ではランダムな値だったのが、Rails 4.2.1ではtable名 + カラム名から生成されるようになったのですが、ドキュメントが古いまま(ランダムな値を生成する)になっていたのを、修正しています。
Merge pull request #19633 from y00rb/sort_router_parameters_duplicated_keys
actionpack/lib/action_dispatch/journey/formatter.rb
、
actionpack/lib/action_dispatch/routing/route_set.rb
の修正です。
マッチするルーティングが無い場合に表示するエラー(UrlGenerationError
)用エラーメッセージの生成時にArgumentError
が発生してしまっていたのを修正しています。
# routes get 'test/:name', :to => "test#test", :as => 'test' # console app.test_path(:foo => 'bar', 'foo' => 'bar') # => ArgumentError: comparison of Array with Array failed
一つのHashにkeyがSymbolとString混在してしまいエラーになってしまったようで、keyを強制的にStringに変換するよう修正しています。
Merge pull request #19685 from vngrs/actionview_parent_layout_bug
actionview/lib/action_view/layouts.rb
の修正です。
親クラスで指定したlayout
が使用されないバグがあったのを修正しています。
class ApplicationController < ActionController::Base layout "bootstrap_v1" end class HomeController < ActionController::Base layout "parallax_v1", only: [:index] end
上記のコントローラーがあった場合に、HomeController
にindex
以外のアクションを作成した場合、親クラスのApplicationController
で定義したbootstrap_v1
がレイアウトに指定されるべきなのですが、親クラスに指定された値が反映されず、デフォルトのレイアウト(application
)が使用されてしまう、というバグだったようです。
Disable Active Job intregration tests.
.travis.yml
の修正です。
一時的にActiveJobのテストを無効にしています。
Fix activejob integration test by troter · Pull Request #19470 · rails/rails で対応予定との事です。
A shorter and more concise version of select..size
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
shallow_nesting_depth
メソッドで、ネスト数を取得するのにselect(..).size
を使用していたのを、count(..)
を使用するよう修正しています。
redcarpet 3.2.2 has an XSS vulnerability
Gemfile
、Gemfile.lock
の修正です。
rails guideで使用しているredcarpet
のバージョンを3.2.3に更新しています。
3.2.2以下のバージョンにはXSS脆弱性がある為バージョンアップしたとの事です。脆弱性についての詳細はoss-security - redcarpet <=3.2.2 (and related ruby gems) allow for possible XSS via autolinking of untrusted markdown ご参照。