2014/06/28分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Add
ActiveRecord::Base#validate!
that raisesRecordInvalid
if the record is invalid. - Detect in-place modifications on String attributes.
- Move 'dependent: :destroy' handling for 'belongs_to' from 'before_destroy' to 'after_destroy' callback chain
- rename sequence only if it exists
Add a test for db:migrate:status to check missing file scenario
railties/test/application/rake/migrations_test.rb
の修正です。
db:migrate:status
のテストケースを追加しています。ファイルを削除されたケース。
Extract AR::SchemaMigration.normalized_versions method
activerecord/lib/active_record/railties/databases.rake
の修正です。
バージョンの正規化処理をnormalized_versions
メソッドに切り出しています。
Use AR::SchemaMigration.table_exists? call instead of longish AR::Base...etc,etc
activerecord/lib/active_record/railties/databases.rake
の修正です。
テーブルのチェック処理にActiveRecord::SchemaMigration.table_exists?
メソッドを使用する用に修正しています。
Stop using instance exec for type decorators
ActiveRecordのdecorator関連の修正です。
decoratorに関連する処理をActiveRecord::Base
から分離しています。
Merge pull request #8639 from bogdan/valid-with-bang
activerecord/lib/active_record/validations.rb
の修正です。
ActiveRecord::Base#validate!
メソッドが追加されています。
名前の通りのメソッドで、レコードがinvalidな失敗した場合、RecordInvalid
がraiseされます。
便利そうなんですが、意外と必要と思った事が無いような気も。
Merge pull request #15788 from sgrif/sg-mutable-strings
activerecord/lib/active_record/type/string.rb
の修正です。
Stringの変更処理を修正しています。コミットログから抜粋。
# Before: user = User.first user.name << ' Griffin' user.name_will_change! user.save user.reload.name # => "Sean Griffin" # After: user = User.first user.name << ' Griffin' user.save user.reload.name # => "Sean Griffin"
user.name_will_change!
の部分が不要になるんですね。これは助かります。
Merge pull request #12450 from iantropov/master
ActiveRecordのassociationsの修正です。
外部キーを使用して:dependent => :destroy
を設定した際に、正しく動作してなかったバグを修正しています。
2013年9月をPRなのですが、昨日外部キー対応がマージされたのに合わせて、こちらもマージされたようです。
Talk about config.assts.version move too
railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt
のdocの修正です。
config.assets.version
がconfig/initializers/assets.rb
に移動しているという事を追記しています。
Note that _will_change!
is no longer needed for AR instances
activemodel/lib/active_model/dirty.rb
のdocの修正です。
今のActiveModelではattributeの変更をトラッキングしてくれるので、_will_change!
は必要無い旨docを修正しています。
We are talking about the libraries, not the constants
もう一回activemodel/lib/active_model/dirty.rb
のdocの修正です。
ActiveRecord
をActive Record
に修正しています。
ライブラリとして説明するときは、Active Record
(スペースが入る)何ですね。
MySQL doesn't works with foreign key
activerecord/test/cases/associations/belongs_to_associations_test.rb
の修正です。
外部キー対応がMySQLで動いていない、との事でテストを一時的に無効化しています。
rename sequence only if it exists
activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
の修正です。
PostgreSQLのAdapterで、テーブルのリネームを行う場合、同名のsequenceがいない場合のみ、primary key sequenceのrenameを行うよう修正しています。
元々は、同名のチェック行って無かったんですね。ケース的には割とレアな気もしますが、危ないですな。
Improve tests to use add_foreign_key DSL
activerecord/test/cases/associations/belongs_to_associations_test.rb
の修正です。
テストの書き方をリファクタリング。
昨日追加されたconfig.always_permitted_parameters
について、docの記述の修正、テストの追加等を行っています。
Update documentation for run_callbacks
activesupport/lib/active_support/callbacks.rb
のdocの修正です。
80文字越えてる文を改行しています。
Do not change the global state of the test suite
activerecord/test/cases/associations/belongs_to_associations_test.rb
の修正です。
テストケースの中でグローバルのstateを変更してしまっている処理を削除しています。
Always instrument ActiveSupport::Cache
activesupport/lib/active_support/cache.rb
の修正です。
ActiveSupport::Cache.instrument=
メソッド、ActiveSupport::Cache.instrument
がdeprecateになりました。Rails 5で削除予定。
ActiveSupport::Cacheの処理はthread local valueを使用しており、マルチスレッド環境では意味が無いとの事でdeprecateになったようです。
Merge pull request #15933 from rafael/master
configファイルにconfig.action_controller.always_permitted_parameters
が追加されました。always_permitted_parameters
については、昨日のコミット参照。
デフォルトは['controller', 'action']
です。
Fix test with add_foreign_key DSL in 9d21ef9
activerecord/test/schema/schema.rb
の修正です。
外部キー対応のテストの修正です。author_address
をauthor_addresses
に修正しています。タイポかなあ。
MySQL doesn't work with foreign keys
activerecord/test/schema/schema.rb
の修正です。
MySQLで外部キー対応が動作してないとの事で、Adapterチェックを追加しています。
Add missing period in Getting Started guide
rails guideのGetting Started with Rails
の修正です。
ピリオドを追加しています。
Update the levenshtein distance method in guides.
guides/rails_guides/levenshtein.rb
の修正です。
レーベンシュタイン距離の計算をしているのですが、結果がおかしかったようです。
rails generatorsにレーベンシュタイン距離計算している処理があるので、そちらをコピーして修正したとの事です。