From b99c3caae8b40df163612e5d1461705a9d16fdb2 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 23 Jul 2017 11:40:14 +0000 Subject: Renames column comments.comments to comments.content to please Rails 5.1 (#23630). git-svn-id: http://svn.redmine.org/redmine/trunk@16860 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- config/initializers/10-patches.rb | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'config') diff --git a/config/initializers/10-patches.rb b/config/initializers/10-patches.rb index 13efe0cb5..e98fa9cf3 100644 --- a/config/initializers/10-patches.rb +++ b/config/initializers/10-patches.rb @@ -27,30 +27,6 @@ module ActiveRecord end end class Relation ; undef open ; end - - # Workaround for a Rails 5.1 regression that breaks queries with a condition - # on a table that has a column with the same name as the table - # (eg. comments.comments). It breaks has_many associations to these tables as well. - # https://github.com/rails/rails/commit/c6a62dc327c54baec87306f5c381e13cacc00a19 - # - # Examples (without the following workaround applied): - # Comment.where(:comments => {:id => 1}) - # TypeError: can't cast Hash - # - # News.first.comments.count - # TypeError: can't cast Hash - class PredicateBuilder - - protected - alias :create_binds_for_hash_without_comments_fix :create_binds_for_hash - def create_binds_for_hash(attributes) - if attributes["comments"].is_a?(Hash) - return create_binds_for_hash_without_comments_fix attributes["comments"] - else - create_binds_for_hash_without_comments_fix attributes - end - end - end end module ActionView -- cgit v1.2.3