2014/05/14分のコミットです。
親子両方のクラスでActiveRecord::Store
を使用している場合に、正しくマージされないバグの修正が行われています。
Fix assertion order and :scissors: extra spaces
actionview/test/template/translation_helper_test.rb
の修正です。
テストメソッド名の修正及び、assert_equal
の引数の順番を修正しています。
[postgres] include PgArrayParser directly and only load/include ArrayParser if not found
PostgresqlのConnectionAdapterに関する修正です。
必ずinclude ConnectionAdapters::PostgreSQLColumn::ArrayParser
していたのを、pg_array_parse
がロード出来なかった時だけinclude
するよう修正しています。
include
処理が減るので、少し性能改善になるのでは、という事です。
Gemfile
の修正です。i18n
をmasterを参照するようにしています。
options already have symbolized keys, so we can avoid this call
actionpack/lib/action_dispatch/routing/route_set.rb
の修正です。
options.symbolize_keys
していたのを、既にsymbolized済み、との事でsymbolize_keys
を削除しています。
the :only_path option is applied by the time the helper is called
actionpack/lib/action_dispatch/routing/route_set.rb
の修正です。
options[:host]
の値に応じて:only_path
オプションの設定を行っていたのですが、:only_path
オプションはヘルパーが呼ばれた時のも適応する、との事なので、ここではオプションの設定処理を行わないように修正しています。
just merge instead of dup and merge
actionpack/lib/action_dispatch/routing/route_set.rb
の修正です。
dup
..merge!
していたのを、merge
だけするように修正しています。
use fewer method calls to determine the url_for options
actionpack/lib/action_dispatch/routing/route_set.rb
の修正です。
メソッド呼び出し減らすようリファクタリングしています。
Remove falsy deprecation note in AS guides [ci skip]
rails guideの"Active Support Core Extensions"のページの修正です。
deprecation対象からdeprecation対象では無くなったファイルがあり、その記述を削除しています。
calls with :host should still use the optimized path
actionpack/lib/action_dispatch/routing/route_set.rb
の修正です。
OptimizedUrlHelper
で:host
の値が必要なので、チェック処理を追加した、かなあ…。
[ci skip] Fix a factual error and highlight code in generators guide.
rails guideの"Creating and Customizing Rails Generators & Templates"のページの修正です。
シングルコーテーションを追加しています。
options should always be passed to url_for
ActionDispatch::Routing::RouteSet#url_for
メソッドの修正です。
元々引数のoptionsにnilを許容していたのを、nilは受け付けない想定に修正しています。
とはいえ、元々nilがきてもエラーになるだけだったような気も。
this method should always have a parameter passed to it, so remove the default
ActionDispatch::Routing::RouteSet#_generate_prefix
メソッドの修正です。
引数のデフォルト値を設定したのを、引数は必ず渡されるので、デフォルト値を削除しています。
extend with a module then use define_method
ActionDispatch::Routing::RouteSet#define_generate_prefix
メソッドの修正です。
redefine_method
でメソッドの拡張をしていたのをdefine_method
を使うよう修正しています。定義されている事は無いから、でしょうか。
no need to check for presence, script names can be blank
ActionDispatch::Routing::RouteSet#url_for
メソッドの修正です。
:script_name
及び:original_script_name
にpresence
チェックを行っていたのを、削除しています。
nil
でなくて、空文字列で問題無いからですかね。
drop || test for cases that do not need it
actionpack/lib/action_dispatch/routing/route_set.rb
の修正です。
||
で存在チェックしていた処理をメソッドに切り出して||
を削除しています。
ActiveSupport::Callbacks#define_callbacks
の修正です。
deprecateになっていたoptionにterminator
が指定された時の処理が削除されています。
we never call url_for with a block, so rm
ActionDispatch::Routing::RouteSet#url_for
メソッドの修正です。
yield
メソッド呼び出し処理を削除しています。
url_for
がblock
付きで呼ばれる事が無いから、との事。
_recall should be set to a hash or not set
ActionDispatch::Routing::RouteSet#url_for
メソッドの修正です。
_recall
オプションがnilの時に、空のハッシュを設定してます。以降nilチェック処理を避ける為、との事。
begin refactoring delete_records method
ActiveRecord::Associations::CollectionAssociation::HasManyAssociation#delete_records
メソッドのリファクタリングです。
delete_all_records
、delete_count
メソッドを新規に作成して、delete_records
の一部処理を切り出していいます。
上の続き。こちらはActiveRecord::Associations::CollectionAssociation::HasManyAssociation#delete_count
メソッドのリファクタリングです。
引数の修正をしています。
rename delete_all_records to delete_or_nullify_all_records
上の続き。delete_all_records
メソッドをdelete_or_nullify_all_records
に修正しています。
HasManyAssociation
、HasManyThroughAssociation
両方です。
上の続き。こちらはActiveRecord::Associations::CollectionAssociation::HasManyAssociation#delete_or_nullify_all_records
メソッドの修正です。
不要な修正処理を行ってしまったらしく、処理を戻しています。
minor: point to the right test suite location
actionview/test/template/sanitize_helper_test.rb
のdocの修正です。
ポインティングしているファイル名が誤っていたのを修正しています。
Fix inheritance of stored_attributes (fixes #14672)
ActiveRecord::Store
の修正です。
親子両方のクラスでstored_attributes
を使用している際に、正しく値のマージが出来ていなかったバグの修正が行われています。
テストケースから抜粋。
first_model = Class.new(ActiveRecord::Base) do store_accessor :data, :color end second_model = Class.new(first_model) do store_accessor :data, :width, :height end third_model = Class.new(first_model) do store_accessor :data, :area, :volume end assert_equal [:color], first_model.stored_attributes[:data] assert_equal [:color, :width, :height], second_model.stored_attributes[:data] assert_equal [:color, :area, :volume], third_model.stored_attributes[:data]
親クラスのActiveRecord::Base
で指定したstore
の値が、子供のsecond_model
、third_model
でも参照出来るんですねえ。
因みに、ActiveRecord::Store
知りませんでした。 JSONがそのまま入れれるのは便利ですね。PostgresqlだとJSON / HStore使えば済むのですが、MySQLの時は重宝しそう。