2015/12/17分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Don't leak Object constants in core_ext/module/qualified_const
- Add thread_m/cattr_accessor/reader/writer suite of methods for declaring class and module variables that live per-thread
actioncable/CHANGELOG.md
Mention the correct way to halt callback chains
rails guideのA Guide for Upgrading Ruby on Rails
の修正です。
Upgrading from Rails 4.2 to Rails 5.0
の項、 callback chainsを停止をさせる方法がfalse
を返す事からthrow(:abort)
に変更になった対応についてのタイトルが紛らわしいタイトルになっていたのを修正しています。
-### Halting callback chains by returning `false` +### Halting callback chains via `throw(:abort)`
Ensure we install the database backend gems on Windows
Gemfile
の修正です。
Windows環境でDB用のgemがインストールされるよう修正しています。
-platforms :ruby do +platforms :ruby, :mswin, :mswin64 do
platform :ruby
はLinux or Macのみ対象となるんですねえ。
Add additional platforms for Windows
Gemfile
の修正です。
MinGW環境でもDB用のgemがインストールされるよう修正しています。
-platforms :ruby, :mswin, :mswin64 do +platforms :ruby, :mswin, :mswin64, :mingw, :x64_mingw do
Add redirect_back
for safer referrer redirects
actionpack/lib/action_controller/metal/redirecting.rb
の修正です。
Referer
ヘッダーが取得出来ればその値、取得出来ない場合は引数(fallback_location
)に指定された値にリダイレクトするActionController::Redirecting::redirect_back
メソッドを追加しています。
redirect_back(fallback_location: root_path)
redirect_to
メソッドに:back
オプションを指定した場合も、Referer
ヘッダーから取得した値にリダイレクト出来るようになっていたのですが、redirect_to :back
の場合、Referer
ヘッダーが取得出来ない場合はRedirectBackError
をraiseするようになっていました。
Referer
ヘッダーが取得出来ないケースは割と考えられる為、エラーをraiseするより、任意の場所にリダイレクト出来た方が便利だろう、という事で追加されたようです。
actionpack/lib/action_controller/metal/redirecting.rb
の修正です。
先の#redirect_back
の対応に伴い、redirect_to
に:back
オプションを指定するのがdeprecateになりました。今後は、#redirect_back
の方を使ってね、との事です。
Require a version of bcrypt that works on Windows when needed
Gemfile
の修正です。
Windowsの場合、3.0系のbcrypt
を使用するよう修正しています。 Windowsではbcrypt
3.1系は今エラーになってしまう為との事です。参考:Ruby 2.2.2 on Windows - LoadError: cannot load such file -- bcrypt_ext · Issue #128 · codahale/bcrypt-ruby
Use Module.prepend instead of alias_method for Range#to_s
activesupport/lib/active_support/core_ext/range/conversions.rb
の修正です。
Range#to_s
メソッドを実装するのに#alias_method
を使用していたのを、Module.prepend
を使用するよう修正しています。
Don't leak Object constants in core_ext/module/qualified_const
Module#qualified_const_xxx
メソッド(#qualified_const_defined?
、#qualified_const_get
、#qualified_const_set
)がdeprecateになりました。
今後は、Ruby標準のメソッド(#const_defined?
、#const_get
、#const_set
)を使うように、との事です。
Avoid conditionals in the Gemfile
Gemfile
の修正です。
Gemfile
でwindows環境のチェックをするのにBundler::WINDOWS
を使用していたのを、platforms :mingw, :x64_mingw, :mswin, :mswin64
を使用するよう修正しています。
-if Bundler::WINDOWS +platforms :mingw, :x64_mingw, :mswin, :mswin64 do gem 'bcrypt-ruby', '~> 3.0.0', require: false -else +end
Gemfile
で分岐処理書いてしまうと、bundle install実行する環境ごとにGemfile.lock
が更新されてしまい宜しく無いので修正した、という事の筈…。
Use sprockets 3 in the Rails 5 release
Gemfile
及びrailtiesの修正です。
sprockets
4系を使用するようにしていたのをやめてsprockets
3系を使用するよう修正しています。
Rails 5ではsprockets 4系にならないんですねえ。
activerecord/test/cases/adapters/sqlite3/sqlite3_create_folder_test.rb
の修正です。
Windowsで、sqlite3がDB用のディレクトリを作成することを確認するテストがコケてしまっていたのを修正しています。
database fileをまだ使用しているのに削除しようとした為エラーになっていたようです。 DBのコネクションを確実にcloseするようにして対応しています。
Fix documentation about ApplicationRecord
rails guideのActive Record Basics
の修正です。
ApplicationRecord
の親クラスをActionController::Base
としてしまっていたのを、ActiveRecord::Base
に修正しています。
activerecord/test/cases/base_test.rb
の修正です。
TimeZoneを指定したテストがWindowsでコケてしまっていたのを修正しています。
TimeZoneにAmerica/New_York
を指定していたのですが、この値がWindows環境で無い為エラーになってしまっていたようです。WindowsではEST5EDT
を使用するよう修正しています。
Gemfile
の修正です。
先のコミットで誤ってmysql
gemをコメントアウトしてしまったのを戻しています。
Add Logger option to disable message broadcasts
activesupport/lib/active_support/logger.rb
、
activesupport/lib/active_support/logger_silence.rb
の修正です。
ActiveSupport::Logger
に、messageのbroadcastsを行うかどうかを指定する為のbroadcast_messages
オプションを追加しています。
development環境でlogの出力先にSTDOUTを指定していた場合に、同じログが2回出力されてしまう問題があり、それを抑止出来るようにる為にオプションを追加しています。
Don't over-specify types in our tests
activerecord/test/cases/migration_test.rb
の修正です。
migrationで生成されるlock_idがFixnum
かどうかチェックしているテストを削除しています。
Windows + PostgreSQLの環境だとOSにより生成される値が違う(BigNum
になる場合がある)事があり、そもそもその値をチェックする必要は無いのでは、という事で削除されたようです。
activerecord/lib/rails/generators/active_record/model/model_generator.rb
の修正です。
使用されていないActiveRecord::Generators::ModelGenerator#accessible_attributes
メソッドを削除しています。
Do not define attributes_with_index as a Thor task
activerecord/lib/rails/generators/active_record/model/model_generator.rb
の修正です。
ActiveRecord::Generators::ModelGenerator#attributes_with_index
メソッドをpublic
からprotected
に移動しています。
public methodだとThorのタスクとして認識されてしまう為、タスクとして認識されないようにする為移動したとの事です。
Make sure File.exist? run in the root of the application
activerecord/lib/rails/generators/active_record/model/model_generator.rb
の修正です。
modelを生成する際、app/models/application_record.rb
が存在するかどうかのチェックを、必ずRails.root
で行うよう修正しています。
- if File.exist?('app/models/application_record.rb') + application_record = nil + + in_root { application_record = File.exist?('app/models/application_record.rb') }
app/models/application_record.rb
が存在する場合のみ、modelの親クラスがApplicationRecord
となるようになり、ファイルが存在しない場合は今まで通りActiveRecord::Base
が親クラスになります。
join_to_delete
is same as join_to_update
activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
、
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
の修正です。
ActiveRecord::ConnectionAdapters::DatabaseStatements#join_to_delete
メソッドの実装が#join_to_update
メソッドと同じだった為、#join_to_delete
メソッドを削除し、#join_to_update
のaliasとして定義するよう修正しています。
が、aliasにする際、#join_to_update
の引数を#join_to_delete
と合わせるようにしたのですが、それにより#join_to_update
メソッドの引数が変わってしまい、既存のライブラリ(oracle-enhanced/oracle_enhanced_adapter.rb at 3c42131db82b64ac41645db3affc6e4650289df6 · rsim/oracle-enhanced)に影響がある為、後ほどrevertされています。
Revert "Merge pull request #22615 from kamipo/join_to_delete_is_same_as_join_to_update"
join_to_delete
is same as join_to_update
をrevertしています。理由は上記参照。
fix typo in method name [ci skip]
activerecord/lib/active_record/base.rb
のdocの修正です。
RecordInvalid
エラーが発生するメソッド名を、ActiveRecord::Base#save
-> ActiveRecord::Base#save!
に修正しています。
[ci skip] Fix grammar and sentence framing
actionmailer/lib/action_mailer/base.rb
のdocの修正です。
ActionMailer::Base#attachments
メソッドのdocの修正です。
グラマーの修正、及び文の構成の修正を行っています。
Merge pull request #22616 from gfvcastro/test-ruby-2-2-4
.travis.yml
の修正です。
CIで実行するRubyのバージョンを2.2.3
-> 2.2.4
に修正しています。
Pass over the ApplicationRecord changelog entry
activerecord/CHANGELOG.md
の修正です。
先日マージされた、ApplicationRecord
についてのentryの説明を、全体的に修正しています。
ApplicationRecord documentation pass
各docの修正です。
doc内の各modelの親クラスを、まとめてActiveRecord::Base
からApplicationRecord
に修正しています。
ApplicationRecord release notes entry
rails guideのA Guide for Upgrading Ruby on Rails
の修正です。
Upgrading from Rails 4.2 to Rails 5.0
の項に、ApplicationRecord
についての説明を追加しています。
Merge pull request #22586 from rails/merge-action-cable
別ブランチで管理されていてAction Cableがrails本体にマージされました。
Action CableはWebSocketsをrailsアプリで使う為のフレームワークです。
RedisのPubSubを使用する為、Action Cableを使用するにはRedisが必須です。また、通常のapp serverとは別にWebSocketsの通信の為のサーバ(cable server)が必要になり、 こちらはPumaが必要になります。
cable serverはrack appなので、通常のrack app同様にconfig.ruを記載する必要があります。
# cable/config.ru require ::File.expand_path('../../config/environment', __FILE__) Rails.application.eager_load! require 'action_cable/process/logging' run ActionCable.server
#!/bin/bash bundle exec puma -p 28080 cable/config.ru
Action Cableを使用するには、server / client両方Channel用の処理が必要なのですが、まだgeneratorが無いので、試したい場合は、Action CableのREADME を見るか、railsが提供しているAction Cable Examplesのコードを見るのがわかりやすいきがします。
Include example of allowed_request_origins
railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt
の修正です。
config.action_cable.allowed_request_origins
を指定した場合のexampleを追加しています。
Deal with leading CR when its not a mountable engine
railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb
の修正です。
mountable engineの場合に、controller testに不要な空白が生成されてしまっていたのを修正しています。
これ、結果的に不要なスペースが生成されるようになってしまったような。
README.rdoc -> README.md for newly generated plugins
rails pluginで生成されるREADMEのフォーマットをrdocからmarkdownに修正しています。
Puma 2.15.3 actually works fine
railties/lib/rails/generators/rails/app/templates/Gemfile
の修正です。
Pumaのインストール先にgithubのmasterを指定していたのを削除しています。リリース済みのPuma 2.15.3で正常に動作する為、との事です。
Kill extra newline at the start of generated manifest.js
railties/lib/rails/generators/rails/app/templates/app/assets/config/manifest.js.tt
の修正です。
生成されるmanifest.jsの先頭から不要な空行を削除しています。
Active Supportの修正です。
thread毎にclass / moduleの変数の設定/取得をする為の、#thread_mattr_writer
、#thread_cattr_writer
、#thread_mattr_accessor
、#thread_cattr_accessor
メソッドを追加しています。
module Current thread_mattr_reader :user end Current.user # => nil Thread.current[:attr_Current_user] = "DHH" Current.user # => "DHH"
activesupport/CHANGELOG.md
の修正です。
Add thread_m/cattr_accessor/reader/writer suite of methods for declaring class and module variables that live per-threadのCHANGELOGのentry内に記載したexampleで使用するクラス・変数名を統一するよう修正しています。
Fix section about ApplicationRecord in upgrading guide [ci skip]
rails guideのA Guide for Upgrading Ruby on Rails
の修正です。
Active Record models now inherit from ApplicationRecord by default
の項、クラス名を誤っていた箇所があったのを修正しています。
Merge pull request #22621 from akshay-vishnoi/add-missing-tests
actionview/test/template/asset_tag_helper_test.rb
の修正です。
asset_path
メソッドに空文字、及びスペースを指定した場合のテストが不足していたのを追加しています。
rails guideのAction Cable –- Integrated WebSockets for Rails
の修正です。
ActiveRecord
-> Active Record
に修正しています。
activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb
の修正です。
thread accessorsのテストで、ファイル名とテストクラス名が異なっていたのを、合わせています。