2015/01/03分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Improve a dump of the primary key support. If it is not a default primary key, correctly dump the type and options.
- Fixed setting of foreign_key for through associations while building of new record.
- Clear query cache on rollback.
Remove support to activerecord-deprecated_finders
ActiveRecordの修正です。
activerecord-deprecated_findersサポート対応の為の処理を削除しています。
Merge pull request #18228 from kamipo/correctly_dump_primary_key
ActiveRecordの修正です。
デフォルト以外のprimary key を使用している場合に、dumpファイルに型とオプションについての情報が正しく出力されてなかったバグがあったのを修正しています。
Remove thread variables backport
activesupport/lib/active_support/core_ext/thread.rb
を削除しています。
Thread変数を扱う為に拡張していたのですが、Ruby 2.0からRuby本体でthread_variables
をサポートしているので、もう不要との事で削除しています。
Merge pull request #17974 from killthekitten/fix-render-block
actionview/lib/action_view/helpers/rendering_helper.rb
の修正です。
render "partial"
にブロックを渡せるよう修正しています。
サンプル。
# `users/index.html.erb` <%= render "shared/search_filters", search: @q do |f| %> <p> Name contains: <%= f.text_field :name_contains %> </p> <%= end %> # `roles/index.html.erb` <%= render "shared/search_filters", search: @q do |f| %> <p> Title contains: <%= f.text_field :title_contains %> </p> <%= end %> # `shared/_search_filters.html.erb` <%= form_for(@q) do |f| %> <h1>Search form:</h1> <fieldset> <%= yield f %> </fieldset> <p> <%= f.submit "Search" %> </p> <% end %>
Merge pull request #17978 from kommen/fixed-pr-14903
actionpack/lib/action_controller/metal/instrumentation.rb
の修正です。
ActiveSupport::Notifications.instrument
を使用して"process_action.action_controller"の計測を行う際、エラーが発生した際にもappend_info_to_payload
を実行するよう修正しています。
- result = super - payload[:status] = response.status - append_info_to_payload(payload) - result + begin + result = super + payload[:status] = response.status + result + ensure + append_info_to_payload(payload)
Merge pull request #15309 from iantropov/issue_12698_build_through
activerecord/lib/active_record/associations/through_association.rb
の修正です。
"has_many through"を使用している時に、build
メソッドでインスタンスを生成した際、foreign_keyが正しく設定されないバグがあったのを修正しています。
Merge pull request #17820 from fw42/restore_query_cache_on_rollback
ActiveRecordの修正です。
translationのrollback時に、query cacheをクリアーするよう修正しています。
Add default value for create_table_definition
ActiveRecordの修正です。
create_table_definition
メソッドの第二引数以降にデフォルト引数を設定しています。殆どのケースで最初の引数しか設定してない為、対応したとの事です。
Refactor visit_ChangeColumnDefinition
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
の修正です。
visit_ChangeColumnDefinition
メソッドのリファクタリングを行っています。
Merge pull request #8547 from printercu/patch-1
activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
の修正です。
invalid encodingが発生した際、エラーメッセージのエンコーディングを変更するよう修正しています。
+ begin + message = "#{e.class.name}: #{e.message}: #{sql}" + rescue Encoding::CompatibilityError + message = "#{e.class.name}: #{e.message.force_encoding sql.encoding}: #{sql}" + end
エンコーディングのエラーが発生しているのに、そのエンコーディングのままメッセージを組み立てようとして更にエラーになってしまうケースがあった為、sql
のエンコーディングを設定したようです。
actionview/lib/action_view/helpers/form_helper.rb
の修正です。
先日行われたfile_field
メソッド実行時にhidden_field
を追加する対応についての説明を修正しています。
Revert part of 996e646bd8cff3bcf2b13863439f48d3e744cdae [ci skip]
The Guide to Testing Rails Applications is published!のコミットの一部をrevertし、Testing Guideをwork_in_progress: true
に戻しています。
その後、Testing Guideリリース用のPRが作成されたので、確認の為にrevertですかねえ。
A quick pass through NestedAttributes' doc [ci skip]
activerecord/lib/active_record/nested_attributes.rb
のdocの修正です。
グラマーの修正、フォーマットの整理等を行っています。
Don't test invalid log encoding against PostgreSQL adapter
activerecord/test/cases/adapter_test.rb
の修正です。
先に行われたinvalid encodingの対応につていのテストをPostgreSQLの場合実施しないよう修正しています。"It already treats the message"とコミットログに記載されているので、対応済み?
Add PolymorphicReflection and constraints method
ここからAssociationScope#add_constraints
メソッドのリファクタリングの為のコミットが続きます。
scope_chain
のflattenバージョンを生成する為のconstraints
メソッドと、PolymorphicReflection
クラスを新規に作成しています。
Add RuntimeReflection for recursive access to chain
activerecord/lib/active_record/associations/association_scope.rb
の修正です。
実行時にreflection情報にアクセスするためのRuntimeReflection
クラスを新規に作成しています。
Refactor construct_tables method
activerecord/lib/active_record/associations/association_scope.rb
の修正です。
construct_tables
メソッド内の処理を別メソッドに切り出して、リファクタリングを行っています。
Clean up assignments in #add_constraints
activerecord/lib/active_record/associations/association_scope.rb
の修正です。
add_constraints
メソッド内で使用している変数を整理しています。
Move #alias_name
to ReflectionProxy
class
activerecord/lib/active_record/associations/association_scope.rb
、
activerecord/lib/active_record/reflection.rb
の修正です。
AbstractReflection#alias_name
メソッドをReflectionProxy
クラスに移動しています。
Refactor #get_chain
to remove need for #construct_tables
activerecord/lib/active_record/associations/association_scope.rb
の修正です。
construct_tables
メソッドを削除し、その中で行われていた処理をget_chain
メソッド内に移動しています。
Refactor #get_chain
iteration to a linked list
activerecord/lib/active_record/associations/association_scope.rb
の修正です。
get_chain
をLinked listでイテレーション出来るようリファクタリングしています。
Clean up / refactor new reflection classes
activerecord/lib/active_record/associations/association_scope.rb
、
activerecord/lib/active_record/reflection.rb
の修正です。
先に作成したPolymorphicReflection
、RuntimeReflection
クラスをreflection.rb
内に移動し、それぞれのクラスの継承関係を整理しています。
Assign the #alias_name
to each reflection
activerecord/lib/active_record/associations/association_scope.rb
、
activerecord/lib/active_record/reflection.rb
の修正です。
各Reflectionクラスでalias_name
を保持するよう修正しています。
Pass connection
rather than alias_tracker
activerecord/lib/active_record/associations/association_scope.rb
の修正です。
add_constraints
メソッドにconnection情報を渡すよう修正しています。
Move alias_candiate
into AbstractReflection
activerecord/lib/active_record/associations/association_scope.rb
、
activerecord/lib/active_record/reflection.rb
の修正です。
ReflectionProxy#alias_candiate
メソッドをAbstractReflection
クラスに移動しています。
Initialze #alias_tracker
with base table name
activerecord/lib/active_record/associations/alias_tracker.rb
の修正です。
AliasTracker
クラスのインスタンス生成用メソッドの引数にテーブル名を追加しています。
Add #all_includes
method to reflections
activerecord/lib/active_record/reflection.rb
の修正です。
RuntimeReflection#all_includes
メソッドを追加しています。
Move #type_caster
to alias tracker initialize
activerecord/lib/active_record/associations/alias_tracker.rb
の修正です。
AliasTracker
クラスのインスタンス生成用メソッドの引数にtype_caster
を追加しています。
Cleanup methods, missing spacing and missing nodocs
activerecord/lib/active_record/associations/association_scope.rb
、
activerecord/lib/active_record/reflection.rb
の修正です。
全体の変数名の整理、:nodoc:の追加、スペースの追加等を行っています。
AssociationScope#add_constraints
メソッドのリファクタリングの為のコミットはここまで。
Merge pull request #8740 from amatsuda/missing_source_file
actionpack/lib/abstract_controller/helpers.rb
の修正です。
default_helper_module!
メソッドでrescueするクラスをMissingSourceFile
-> LoadError
に修正しています。 MissingSourceFile
についての説明は次のコミットで。
Deprecate MissingSourceFile
in favor of LoadError
.
activesupport/lib/active_support/core_ext/load_error.rb
の修正です。
MissingSourceFile
クラスがdeprecateになりました。
元々、MissingSourceFile
はLoadError
クラスのエイリアスでしかなく、既にRailsの中で使用している箇所も無いことから、deprecateにしたとの事です。
Merge pull request #9065 from atombender/master
activesupport/lib/active_support/tagged_logging.rb
の修正です。
複数のLoggerを使用している場合に、タグ情報が異なるLoggerにもシェアされてしまうバグがあったのを修正しています。
以下例。
my_logger = ActiveSupport::TaggedLogging.new(Logger.new($stdout)) my_logger.push_tags "my_tag" Rails.logger.info "test" # outputs "[my_tag] test" Rails.logger.tagged("other_tag") do my_logger.info "test" # outputs "[my_tag] [other_tag]" end
ちょっと使い方が特殊な感もありますが…。
Support datetime values in AR::Type::DateTime#type_cast_for_database
activerecord/lib/active_record/type/date_time.rb
の修正です。
ActiveRecord::Base.default_timezone
に:local
を設定している場合にdatetime
型のカラムのデータの読み込み時にエラーがおこるバグがあったのを修正しています。
Unsafe default translations should not be marked html_safe
actionview/lib/action_view/helpers/translation_helper.rb
の修正です。
translate
メソッドのdefault
引数に値を指定し、default
の値が返される場合に、リターンされる値にはhtml_safe
が設定されていたのですが、
default
設定する値はただの文字列であり、html_safe
フラグが設定されているのはおかしいのでは、という事で、html_safe
フラグは設定されないよう修正しています。
translation = translate(:'translations.missing', :default => [:'translations.missing_html', :'translations.foo']) translation translation.html_safe? # => false
Merge pull request #10380 from JonRowe/test_all_domain_2_letter_tld
actionpack/test/dispatch/cookies_test.rb
の修正です。
@request.host
にTOP Level Domainに2文字、domainに3文字のホスト名を設定した場合のテストを追加しています。
Generated fixtures won't use parent_id when generated with parent:references
railties/lib/rails/generators/test_unit/model/templates/fixtures.yml
の修正です。
generatorにreferences
を指定した場合に、生成されるfixturesのファイル内のアソシエーションの定義から、"_id"を削除するよう修正しています。
Update Redcarpet to version 3.2.2
Gemfile
、guides/rails_guides.rb
の修正です。
redcarpet のバージョンを3.2.2に更新しています。
Consider html+erb
as a valid language for snippets
guides/rails_guides/markdown/renderer.rb
の修正です。
rails guideのスニペットのlangにhtml+erb
を指定した場合に正しくハイライトされるよう修正しています。
Avoid displaying new lines inside note paragraphs
guides/assets/stylesheets/main.css
の修正です。
"note"パラグラフのスタイルを修正し、変な箇所で改行がされないよう対応しています。