2016/04/20分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Add
to_sentence
helper that is a HTML-safe aware version ofArray#to_sentence
. date_select
helper:with_css_classes
option now accepts a hash of strings for:year
,:month
,:day
,:hour
,:minute
,:second
that will extend the select type with the given css class value.
Update send_data documentation [ci skip]
actionpack/lib/action_controller/metal/data_streaming.rb
のdocの修正です。
#send_data
メソッドのdoc内の行の終端に.
が無い箇所があったので、追加しています。
Remove reference to unknown method dirty?
to docs
rails guideのUsing Rails for API-only Applications
の修正です。
存在しないメソッド(dirty?
)について説明が行われている箇所があったのを削除しています。
Merge pull request #24567 from Edouard-chin/ec-method-typo
actionmailer/lib/action_mailer/test_case.rb
の修正です。
テスト用のメソッド名でタイポ(clear_test_deliviers
-> clear_test_deliveries
)していた箇所があったのを修正しています。
Define arel_visitor
method on all adapters
Active Recordの修正です。
arel visitorの生成処理にArel::Visitors::VISITORS
を使用しabstract adapterで行うよう昨日修正が行われたのですが、Arel::Visitors::VISITORS
定数がarel側で削除済みだった(Delete not used codes)為、各connection adapterで、それぞれのadapter毎のvisitorsクラスを指定し処理を行うように修正しています。
- Added documentation for ActiveJob queue adapter for a specific job.
rails guideのActive Job Basics
の修正です。
Setting the Backend
の項に、job class毎にqueue adapterを指定する場合についての説明を追加しています。
Database comments: Treat blank comments as no comment. Don't dump blank comments.
Active Recordの修正です。
commentが空の場合に、dump fileにcommentを生成しないよう修正しています。
activerecord/test/cases/comment_test.rb
の修正です。
テストの終端にあった不要なコメントを削除しています。
-end # if ActiveRecord::Base.connection.supports_comments? +end
実際は不要なコマンドではなく、if
の終端をわかりやすくする為のコメントだったようなのですが、そのまま削除されています。
mention rails 5 instead of rails 4 in bin/rails for plugins
railties/lib/rails/generators/rails/plugin/templates/bin/rails.tt
の修正です。
rails pluginで生成されるrails
スクリプト内のコメントに、…run "rails" with Rails 4 gems…
というようにRailsのバージョンを指定したコメントがあったのを、バージョンの指定を削除しています。
Merge pull request #24031 from samphilipd/sam/do_not_clobber_options_in_route_definitions
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
#scope
メソッドで、引数のoptions自体の値を変更するようになってしまっていたのを、変更しないよう修正しています。
- (options[:defaults] ||= {}).reverse_merge!(defaults) + options[:defaults] = defaults.merge(options[:defaults] || {})
HTML = { constraints: { format: :html } }.freeze scope HTML do get 'x' end
上記のように、freezeした値を渡したり、optionsの使いまわしをしたい時に問題になってしまう為。
Fix test_blank_columns_created_in_block
activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
の修正です。
先ほど、commentが空の場合に、dump fileにcommentを生成しないよう修正されたのですが、columnについてのcommentで修正が漏れてしまっていた箇所があったので、追加で修正しています。
Ensure Cache#inspect doesn't block concurrent cache writes
actionview/lib/action_view/template/resolver.rb
の修正です。
ActionView::Resolver::Cache#inspect
メソッドを追加しています。
+ def inspect + "#<#{self.class.name}:0x#{(object_id << 1).to_s(16)} keys=#{@data.size} queries=#{@query_cache.size}>" + end
Object#inspect
だと全てのインスタンス変数を再帰的に検査するので、表示されるべきではない内部の状態についてのデータも表示されてしまう、かつ、並列で同時に実行した場合に他のスレッドのcacheの書き込みをブロックしてしまう事があるので、必要な情報だけを表示するようメソッドを追加したようです。
Merge pull request #23869 from oreoshake/to-sentence-html-safety
actionview/lib/action_view/helpers/output_safety_helper.rb
の修正です。
ActionView::Helpers::OutputSafetyHelper
moduleに、to_sentence
メソッドを追加しています。
Array#to_sentenceメソッドの、html safe版との事です。
helper.to_sentence(%w(< > & ' ")) # => "<, >, &, ', and "" helper.to_sentence(%w(<script>)) # => "<script> helper.to_sentence(['one', 'two', 'three'], words_connector: ' & '.html_safe) # => "one & two, and three"
Add CHANGELOG entry for #23869
actionview/CHANGELOG.md
の修正です。
先のto_sentence
メソッドの対応について、CHANGELOGにentryを追加しています。
Merge pull request #24225 from neumayr/date_select_helper_with_css_classes_accept_hash
actionview/lib/action_view/helpers/date_helper.rb
の修正です。
date_select
メソッドの:with_css_classes
オプションで、項目(year
、month
、day
等)毎に個別のclassを指定出来るよう修正しています。
CHANGELOGより。
<%= f.date_select :birthday, with_css_classes: { month: "my-month", year: "my-year" } %>
<select id="user_birthday_3i" name="user[birthday(3i)]">…</select> <select id="user_birthday_2i" name="user[birthday(2i)]" class="my-month">…</select> <select id="user_birthday_1i" name="user[birthday(1i)]" class="my-year">…</select>
Merge pull request #20625 from Envek/add_country_zones_method
Active Supportの修正です。
任意の国のtimezoneの一覧を取得する為の、ActiveSupport::TimeZone.country_zones
メソッドを追加しています。
ActiveSupport::TimeZone.country_zones('us').map(&:to_s) # => ["(GMT-10:00) Hawaii", "(GMT-09:00) Alaska", "(GMT-08:00) Pacific Time (US & Canada)", "(GMT-07:00) Arizona", "(GMT-07:00) Mountain Time (US & Canada)", "(GMT-06:00) Central Time (US & Canada)", "(GMT-05:00) Eastern Time (US & Canada)", "(GMT-05:00) Indiana (East)"] ActiveSupport::TimeZone.country_zones('fr').map(&:to_s) # => ["(GMT+01:00) Paris"]
また、同じ結果を表示する為のtask(time:zones
)も追加されています。
./bin/rails "time:zones[US]" * UTC -10:00 * Hawaii * UTC -09:00 * Alaska * UTC -08:00 * Pacific Time (US & Canada) * UTC -07:00 * Arizona Mountain Time (US & Canada) * UTC -06:00 * Central Time (US & Canada) * UTC -05:00 * Eastern Time (US & Canada) Indiana (East)
activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
の修正です。
#select_rows
、#execute
をundef_method
で見えないようにしていたのを止めて、代わりにNotImplementedError
をraiseするように修正しています。
def select_rows(sql, name = nil, binds = []) + raise NotImplementedError end - undef_method :select_rows
subclassで実装されている事が期待されているメソッドであり、NotImplementedError
をraiseするのが正しい挙動の為。 因みに、undef_method
していたのは、subclassで該当のメソッドが実装されていない場合に、RDocが生成されないようする為、だったようです。
actionview/lib/action_view/helpers/date_helper.rb
のdocの修正です。
date_select
メソッド内のdocのグラマーの修正を行っています。
Fix example for css_class_attribute and fix indentation
actionview/lib/action_view/helpers/date_helper.rb
の修正です。
css_class_attribute
メソッドのコードのインデントの修正、及びdoc内のexampleコードで、オプションの指定の仕方が間違っていたのを修正しています。
use rails command in time:zones
task desc [ci skip]
railties/lib/rails/tasks/misc.rake
の修正です。
先ほど追加されたtime:zones
taskのdescription内のexampleで、rake
コマンドを使うようになっていたのを、rails
コマンドを使用するよう修正しています。
~3.5x speedup of String#blank? for empty strings
activesupport/lib/active_support/core_ext/object/blank.rb
の修正です。
String#blank?
メソッドで、Stringが空かどうかのチェックに正規表現(BLANK_RE = /\A[[:space:]]*\z/
)を使用してチェックしているのですが、正規表現でチェックするより前に、#empty?
メソッドでチェックを行うよう修正しています。
def blank? - BLANK_RE === self + # In practice, the majority of blank strings are empty. As of this writing + # checking for empty? is about 3.5x faster than matching against the regexp + # in MRI, so we call the predicate first, and then fallback. + # + # The penalty for blank strings with whitespace or present ones is marginal. + empty? || BLANK_RE === self end
本当に只の空文字(スペース等も無い空文字)の場合に、こちらの方が早い為。