2016/02/02分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
Shorten ActiveRecord::InternalMetadata.table_name to ar_internal_metadata
activerecord/lib/active_record/model_schema.rbの修正です。
ActiveRecord::InternalMetadata.table_nameをactive_record_internal_metadatasからar_internal_metadataに修正しています。
ORACLEではidentifierに30 byteまでしか使えない為、との事です。
Rename active_record_internal_metadatas to ar_internal_metadata
activerecord/lib/active_record/internal_metadata.rbの修正です。
既にactive_record_internal_metadatasテーブルがある場合に、ar_internal_metadataにテーブル名を変更するよう修正しています。
Merge pull request #23381 from matthewd/uneventful-redis
Action Cableの修正です。
SubscriptionAdapterのredis adapterで、hiredis(redis/hiredis-rb - Ruby)を使用するようにし、Event Machine(というかem-hiredis)は使用しないよう修正しています。
元々のEvent Machineを使用した実装は、evented_redisという名前に変更し、変わらず使用出来るようになっています。
Merge pull request #23057 from schneems/schneems/default-puma-config
railtiesの修正です。
rails newした際に、デフォルトのPumaの設定ファイルも生成するよう修正しています。
内容は下記の通り。
#config/puma.rb # Puma can serve each request in a thread from an internal thread pool. # The `threads` method setting takes two numbers a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum # and maximum, this matches the default thread size of Active Record. # threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i threads threads_count, threads_count # Specifies the `port` that Puma will listen on to receive requests, default is 3000. # port ENV.fetch("PORT") { 3000 } # Specifies the `environment` that Puma will run in. # environment ENV.fetch("RAILS_ENV") { "development" } # Specifies the number of `workers` to boot in clustered mode. # Workers are forked webserver processes. If using threads and workers together # the concurrency of the application would be max `threads` * `workers`. # Workers do not work on JRuby or Windows (both of which do not support # processes). # # workers ENV.fetch("WEB_CONCURRENCY") { 2 } # Use the `preload_app!` method when specifying a `workers` number. # This directive tells Puma to first boot the application and load code # before forking the application. This takes advantage of Copy On Write # process behavior so workers use less memory. If you use this option # you need to make sure to reconnect any threads in the `on_worker_boot` # block. # # preload_app! # The code in the `on_worker_boot` will be called if you are using # clustered mode by specifying a number of `workers`. After each worker # process is booted this block will be run, if you are using `preload_app!` # option you will want to use this block to reconnect to any threads # or connections that may have been created at application boot, Ruby # cannot share connections between processes. # # on_worker_boot do # ActiveRecord::Base.establish_connection if defined?(ActiveRecord) # end
また、合わせて、skip_pumaオプションが追加されています。puma使用したく無い場合は、rails newにskip_pumaオプションを指定すると、上記設定ファイル及びGemfileからpumaが削除されます。
[ci skip] Properly indent code in markdown
activesupport/CHANGELOG.mdの修正です。
example codenのインデントがおかしくなってしまっている箇所があったのを修正しています。
actionpack/lib/action_dispatch/http/cache.rbのdocの修正です。
ActionDispatch::Http::Cache::Response#etag=メソッドにdocを追加しています。
git protocol replaced with https
rails guideのContributing to Ruby on Railsの修正です。
github.comからコードを取得するexampleで、gitプロトコルを使用していたのを、httpsプロトコルを使用するよう修正しています。
Add options for rake routes task
Action Packの修正です。
rake routes taskに、-g(grep)及び-c(controller_name)オプションを指定出来るよう対応しています。
-c(controller_name)はオプション名の通り指定したcontrollerに一致するroutesを、-g(`grep')は引数の文字列に一致するroutesを表示するようになっています。文字列はcontroller名だけでなく、action名でもヒットするようになっているようです。
$ ./bin/rails routes -c UserController
Prefix Verb URI Pattern Controller#Action
users GET /users(.:format) users#index
POST /users(.:format) users#create
new_user GET /users/new(.:format) users#new
edit_user GET /users/:id/edit(.:format) users#edit
user GET /users/:id(.:format) users#show
PATCH /users/:id(.:format) users#update
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
$ ./bin/rails routes -g show
Prefix Verb URI Pattern Controller#Action
purchase GET /purchases/:id(.:format) purchases#show
user GET /users/:id(.:format) users#show
-cオプションが追加された事により、CONTROLLER envはdeprecateになりました。今後は、-cオプションの方を使用して下さい、との事です。
rails guideのContributing to Ruby on Railsの修正です。
github.comからコードを取得するexampleでgitプロトコルを使用していたのをhttpsプロトコルを使用するよう修正した対応で、タイポ(リポジトリの指定の際に.gitが抜けていた)があったのを修正しています。
Merge pull request #23398 from matthewd/interlock https://github.com/rails/rails/pull/23398
Active Supportのロック処理の修正です。
Dependencies.interlock配下で複数スレッド動作した場合に、.rbファイルの更新が正しく検知出来ないバグがあったのを修正しています。
issueの詳細はUnder concurrent load Dependencies.interlock might miss file changes · Issue #21006 · rails/rails参照。
Revert "Merge pull request #16400 from bogdan/last-with-sql"
ActiveRecord::Relation#lastのリファクタリングを行った、Reworked ActiveRecord::Relation#last to always use SQLをrevertしています。
lastとlimitを同時に使用した場合の挙動でリグレッションが発生してしまった為、及び、Rails 5.0.0.beta2をリリースする為、との事です。
Simplify filter normalization.
actionpack/lib/action_dispatch/routing/inspector.rbの修正です。
ActionDispatch::Routing::RoutesInspector#normalize_filterメソッドのリファクタリングを行っています。
不要な引数の型チェックの削除、戻り値に明示的にnilを指定していたのを削除、等を行っています。
Fix corrupt transaction state caused by before_commit exceptions
activerecord/lib/active_record/connection_adapters/abstract/transaction.rbの修正です。
before_commit callbackでexceptionが発生した場合に、DBではrollback処理が行われるのに、ActiveRecordのtransactionがそのままになってしまうバグがあったのを修正しています。
transaction = @stack.last - transaction.before_commit_records - @stack.pop + + begin + transaction.before_commit_records + ensure + @stack.pop + end
exceptionが発生した場合に、transaction stackがそのまま(pop処理が通らない)のが問題だったようです。ムズい。
actionpack/lib/action_dispatch/routing/inspector.rbの修正です。
同じ値を扱う変数名にfilterを使用している箇所とfilter_optionsを使用している箇所があったのを、filterに統一するよう修正しています。
railties/lib/rails/tasks/routes.rakeの修正です。
Hashの括弧の前後にスペースを追加しています。
Preparing for Rails 5.0.0.beta2
各gemのバージョンを5.0.0.beta2に更新しています。
Add some Action Cable CHANGELOG entries
actioncable/CHANGELOG.mdの修正です。
dependencyからCelluloidを削除した対応、dependencyからEventMachineを対応、及びpubsubのadapterにPostgreSQL pubsubを追加した対応について、CHANGELOGに追記しています。
actionpack/CHANGELOG.mdの修正です。
code exampleのインデントがおかしくなってしまっている箇所があったのを修正しています。
:warning: assigned but unused variable - err
railties/lib/rails/commands/runner.rbの修正です。
rails runnerで使用していない変数があったのを削除しています。
Generated engines should protect from forgery
rails/railties/lib/rails/generators/rails/plugin/templates/app/controllers/%namespaced_name%/application_controller.rb.ttの修正です。
Rails Engineで生成するApplicationControllerでprotect_from_forgeryメソッドが使用されるようになっていなかったのを、protect_from_forgeryメソッドを使用するよう修正しています。
Fix regression in Hash#dig for HashWithIndifferentAccess.
activesupport/lib/active_support/hash_with_indifferent_access.rbの修正です。
HashWithIndifferentAccessでHash#digメソッドが正しく動作しないバグがあったのを修正しています。
data = {"this" => {"views" => 1234}}.with_indifferent_access
data.dig(:this, :views) #=> "1234"が戻るべきが、"nil"が戻ってくる
Merge pull request #23396 from pschambacher/pschambacher/fix_assert_generates
actionpack/lib/action_dispatch/testing/assertions/routing.rbの修正です。
assert_generatesメソッドで引数のoptionsの値を直接書き換えてしまっていたのを、dupし、元の値は書き換えないよう修正しています。
move test_generator_if_skip_action_cable_is_given_for_an_api_app to the appropriate file
railties/test/generators/api_app_generator_test.rb、
railties/test/generators/app_generator_test.rbの修正です。
rails apiに関するテストがapp_generator_test.rbに定義されていたのを、api_app_generator_test.rbに定義するよう修正してます。
Merge pull request #23331 from amatsuda/valid_scope_name
activerecord/lib/active_record/scoping/named.rbの修正です。
named scopeが既に存在するscope / methodを上書きする際、warningを表示するよう修正しています。
例。
class User < ApplicationRecord scope :test, -> { where(id: 1) } def test end end
上記のようなmodelがあった場合、クラスロード時に下記warningが表示されます。
Creating scope :test. Overwriting existing method User.test.
Rails 3系では元々同様のwarningが出るようになっていのたですが、Ruby自体のwarningを表示するようにすればメソッドを上書きしている旨warningが表示される為、そちらを見れば良いだろうという事で一度削除されていました(Remove valid_scope_name? check - use ruby · rails/rails@f6db31e)。
ただ、Rubyのwarningを表示するようにした場合、Railsが使用している各種gemから大量にwarningが出てしまい、必要なwarningを見つけるのは難しい為、Rubyの設定関係無く再度warning出力するよう修正したとの事です。
Remove unnecessary overriding of #initialize
activerecord/lib/active_record/reflection.rbの修正です。
HasManyReflection#initialize、HasOneReflection#initialize、BelongsToReflection#initializeを削除しています。
まったく同じ引数のまま、親クラスのinitialize(AssociationReflection#initialize)を呼び出しているだけだった為、不要だろう、という事で削除されています。
Change command_task.rb to commands_task.rb in docs
rails guideのThe Rails Initialization Processの修正です。
rails/commands/commands_tasks.rbをrails/commands/command_tasks.rbにタイポしていたのを修正しています。