2014/04/18分のコミットです。
Bring SQLite3Adpter init API closer to others
sqlite3_adapterの修正です。initialize
の引数にconnection_options
を追加しています。
- def initialize(connection, logger, config) + def initialize(connection, logger, connection_options, config)
他のアダプタ(MySQL/Postgresql)とフォーマットを合わせる為の修正ですね。
action_dispatch/http/upload.rb
に:tempfile
のaliasとして:to_io
を追加しています。
to_io
メソッド知らなかったのですが、Objectクラスのメソッドとして定義されているんですね。マニュアルはこちら。
上記to_io
の追加の、テストメソッド名を修正しています。
Add CHANGELOG entry for #14755 [ci skip]
上記to_io
の追加について、CHANGELOGに追記しています。
Merge pull request #14738 from tilsammans/pull/11407
hidden_fields
メソッドで生成されるhtmlからdiv
タグを削除しています。
HTML 4.01/XHTMLでは、formタグの直下にinputタグを書いてはいけなかったため、生成されるHTMLに<div style="display:none">
を追加していましたが、HTML5では直下にinputタグを記載するのがOKなので、div
タグを除去している、との事です。
Update Request forgery tests to remove input wrappign div
上記コミットに伴い、Request forgery確認のテストから不要になったdiv
タグを削除しています。
Remove wrapper div for inputs in button_to
こちらもhidden_fields
の修正に伴うテストの修正です。button_to
メソッドのテストからdiv
タグを削除しています。
Include default rails protect_from_forgery with: :exception
rails guideの修正です。
CSRFが発生した場合、execeptionを発生させ、適切にハンドリングするのが良いのではないか、という事で、rails guideのprotect_from_forgery
の箇所をprotect_from_forgery with: :exception
に修正しています。
rails 4.0からデフォルトで生成されるコードもprotect_from_forgery with: :exception
になっているので、そちらと合わせる形かと。
Postgresのadapterの修正です。select_value
, select_values
, select_rows
の最適化が行われています。
共通処理のexecute_and_clear
への切り出し、及び、不要なActiveRecord::Result
の生成を行わないようにしています。
select_value
は8% ips程度の向上(before: 4729.1 (±3.1%) i/s after: 5139.9 (±3.3%) i/s) 、 select_values
は18%程度の改善(before 2085.1 (±4.3%) i/s after 2476.3 (±4.2%) i/s)したそうです。(あくまで参考値)
rais guideの修正です。細かなスペルの修正、空白の削除等を行っています。
Singularize association names before camelization
activerecord/lib/active_record/reflection.rb
のderive_class_name
メソッドで、camelize
する前にsingularize
するよう修正しています。
これだけだと良く分からないので、テストコードを参考に。
ActiveSupport::Inflector.inflections do |inflect| inflect.irregular 'plural_irregular', 'plurales_irregulares' end reflection = AssociationReflection.new(:has_many, 'plurales_irregulares', nil, {}, ActiveRecord::Base) assert_equal 'PluralIrregular', reflection.class_name
複数の単語が複数形で定義されている場合(上記例だと、plurales_irregulares
)に、has_many associationで適切なクラス名が取得出来ず、エラーになってしまっていたのを修正しています。
ActiveSupport::Inflector.inflections
でinflection
のルールの追加が出来るんですね。詳しくはapi.rubyonrails.org参考。
Regression test for irregular inflection on has_many
上記コミットについて、テストコードを追加しています。
rails guideの修正です。asset pipelineの項で、指定するgemの名前が誤っていたのを修正しています。
-config.assets.js_compressor = :uglify +config.assets.js_compressor = :uglifier
タイポですね。