2015/08/11分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
activejob/CHANGELOG.md
we have the resource on the stack, so just use it
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
resource_scope
メソッドで、controller_scope
メソッドを呼び出す際の引数のresourceを取得するのに、parent_resource
メソッドで取得していたのを、自身のメソッドの引数に指定されたresource
を使用するよう修正しています。
pass shallow
in to the resource constructor
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
Resource
クラスのコンストラクタにshallow
変数を追加しています。セッターメソッドを削除&Resource
オブジェクトをread onlyにするためとの事です。
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
Mapper
クラスからnesting
変数を削除しています。 @scope
のlinked listから同じ情報を取得出来、そちらから取得する為不要との事です。
add a null node at the top of the stack
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
@scope
stackの先頭にnull nodeを追加しています。stack のイテレーションをしやすくする為、との事なのですが、よくわからなかった…。
Update info on browser connection limits [ci skip]
actionview/lib/action_view/helpers/asset_url_helper.rb
のdocの修正です。
ブラウザの同時接続数についての説明を修正しています。
[ci skip] Fix simultaneous spelling
actionview/lib/action_view/helpers/asset_url_helper.rb
のdocの修正です。
simulataneous
-> simultaneous
にタイポを修正しています。
reuse the same frame so we don't need a singleton hash
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
Scope#new_level
メソッドで、新規にscope作成する際に、空のHashではなく、定義済みのframeを使いまわすよう修正しています。
push with_scope_level
up so resource_scope doesn't know
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
with_scope_level
の呼び出しをresource_scope
より先に行うよう修正しています。
resource_scope
はresource scopesをstackに追加しているだけで、scope_level
についての情報は保持していない為、との事です。
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
root
メソッドの中でscope
メソッドを直接呼び出していたのを、path_scope
メソッドを使用するよう修正しています。
scope
メソッドの呼び出し処理はコストが高いので、極力使わないよう修正しているようです。
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
Mapper#shallow?
メソッドでresource objectがシングルトンかどうかinstance_of?
メソッドを使っていたのを、各resource classにsingleton?
メソッドを追加し、そちらのメソッド経由で確認するよう修正しています。
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
使用しなくなったwith_exclusive_scope
メソッドを削除しています。
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
controller
メソッドの中でscope
メソッドを直接呼び出していたのを、controller_scope
メソッドを使用するよう修正しています。
let the controller
method push / pop the stack
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
controller
メソッドはcontroller_scope
メソッドを呼び出すだけしかしていなかったので、controller
メソッドにcontroller_scope
メソッドの処理を移動し、controller_scope
メソッドは削除しています。
avoid calling scope
on defaults
methods
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
defaults
メソッドでscope
メソッドを呼びださないず、Scope
クラスを使用し処理を行うよう修正しています。
pull defaults
extraction up the stack.
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
Mapping.build
で行っていたdefaults
オプションに関する処理を、map_method
メソッドで行うよう修正しています。コミットログにup the stack
となっているので、早めに処理を行う為、ですかねえ。
Make assert_enqueued_with and assert_performed_with returns the matched job
activejob/lib/active_job/test_helper.rb
の修正です。
assert_enqueued_with
、assert_performed_with
メソッドが、引数に指定した情報とマッチするjobのインスタンスを返すよう修正しています。
実行したjobのインスタンスに対して、テストを行いたい事がある為とのことです。例。
job = assert_enqueued_with(job: SomeJob) do some_business_logic end assert_in_delta 5.minutes.from_now, job.scheduled_at, 1 assert_equal 5, job.arguments.second
Merge pull request #21184 from brooksreese/touch_on_unit_testing
rails guideのThe Rails Command Line
の修正です。
rails generate
の項、unit testについて説明している箇所に、testing guideへのリンクを追加しています。
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
path_for_action
メソッドとaction_path
メソッドそれぞれでpath
のチェックを行っていたのを、path_for_action
メソッドだけで行うよう修正しています。
always cast name
to a symbol, and never to_s it
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
action_path
メソッドのname
引数の不要なStringへの変換処理を削除しています。 action_path
に値が渡る際は、必ずStringになっている為、との事。
try to pass fewer options to scope
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
namespace
メソッドでscope
を呼び出す際、options
をまるまる渡していたのを、先にpath_scope
メソッドを呼び出してpathに関する処理はそちらで行うようにし、scope
メソッドにはpathについての情報を渡さずに済むよう修正しています。
Only use path if the key is not present
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
namespace
メソッドで、明示的にpath
オプションにnil
が指定されていた場合に、設定されてないとみなすようになってしまっていたのを、nil
が指定された場合にnil
のまま扱うよう修正しています。
Merge pull request #21191 from byroot/deprecate-si-prefix
activesupport/lib/active_support/number_helper/number_to_human_size_converter.rb
の修正です。
number_to_human_size
メソッドのprefix
オプションを使用するのはdeprecateになりました。代わりのオプションも無しです。
prefix
オプション、si formatを付与する為のオプションだったのですが、設定した場合の表示がどうなるかわかりずらいし、そもそもそんなに使用するようなものでも無いので、削除する事になったようです。 詳細はAdded :prefix => :iec option by jarl-dk · Pull Request #7835 · rails/rails 参照。
:nodoc: internal class [ci skip]
activesupport/lib/active_support/notifications/fanout.rb
の修正です。
内部用クラスであるTimed
クラスに:nodoc:
オプションを追加しています。
Merge pull request #21138 from dhiachou/patch-2
rails guideのRuby on Rails Security Guide
の修正です。
Railsのセキュリティ機構についての説明がRails 2系のころの説明のままになっていたのを、最新のRailsのセキュリティ機構に合わせて内容を更新しています。
Merge pull request #21165 from manlon/master
activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb
の修正です。
HABTMを使用している、かつ、2つのmodelで違うDBへのコネクションを保持していた場合に、HABTM先のデータにアクセスした際に、ActiveRecord::StatementInvalid
がraiseされてしまうバグがあったのを修正しています。
例。
class Secondary < ActiveRecord::Base establish_connection :secondary self.abstract_class = true end class SecondaryModel < Secondary has_and_belongs_to_many :secondary_associateds end m = SecondaryModel.create! puts m.secondary_associateds.count # works fine m.secondary_associateds << something # raises ActiveRecord::StatementInvalid: Could not find table 'secondary_associateds_models'
DBのコネクションを見に行く際、正しくmodelからretrieve_connection
を取得するよう修正しています。こんな使い方される方もいるんですねえ。
Tiny documentation fixes [ci skip]
actionpack/lib/action_dispatch/routing/mapper.rb
のdoc、
guides/source/routing.md
、guides/source/security.md
の修正です。
タイポの修正、1行80文字に収まるよう適切な位置に改行を追加、等をまとめて行っています。
Merge pull request #17885 from starbelly/patch-1
activerecord/lib/active_record/tasks/postgresql_database_tasks.rb
の修正です。
PostgreSQLDatabaseTasks
クラスで、pg_dump
等のPostgres標準のコマンドを実行しエラーになった場合に、failし、適切なエラーメッセージを表示するよう修正しています。
実行例。
$ bin/rake db:structure:dump rake aborted! failed to execute: pg_dump -i -s -x -O -f /Users/senny/Projects/playground/ruby/rails/rails-master/db/structure.sql my_db Please check the output above for any errors and make sure that `pg_dump` is installed in your PATH and has proper permissions. /Users/senny/Projects/rails/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb:99:in `run_cmd' /Users/senny/Projects/rails/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb:64:in `structure_dump' /Users/senny/Projects/rails/activerecord/lib/active_record/tasks/database_tasks.rb:182:in `structure_dump' /Users/senny/Projects/rails/activerecord/lib/active_record/railties/databases.rake:276:in `block (3 levels) in <top (required)>' Tasks: TOP => db:structure:dump
Merge pull request #21187 from arthurnn/method_missing_routes_av
actionview/lib/action_view/test_case.rb
の修正です。
TestController#method_missing
メソッドで、_routes
呼び出し処理をbegin
/rescue
で囲んで、エラーが返されないよう修正しています。
- if @controller.respond_to?(:_routes) && - ( @controller._routes.named_routes.route_defined?(selector) || - @controller._routes.mounted_helpers.method_defined?(selector) ) + begin + routes = @controller.respond_to?(:_routes) && @controller._routes + rescue + # Dont call routes, if there is an error on _routes call + end + + if routes && + ( routes.named_routes.route_defined?(selector) || + routes.mounted_helpers.method_defined?(selector) )
下記のようなテストを実行した場合、 _routesメソッドの呼び出しで、RuntimeError: In order to use #url_for, you must include routing helpers explicitly. For instance, includeRails.application.routes.url_helpers
が発生してしまうのですが、url_for
メソッドを呼び出してないのに、左記のようなエラーが出るのは良くないだろう、という事で、エラーを潰すようにしたようです。
class BugTest < ActionView::TestCase def test_foo omg end end