diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-07-23 11:40:14 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-07-23 11:40:14 +0000 |
commit | b99c3caae8b40df163612e5d1461705a9d16fdb2 (patch) | |
tree | 8de5b9441746ff67e5a342eb12cf72fd4a468c3c /config/initializers | |
parent | d74f0bfd5c53962e332c2dd4d30dafaa1105b92b (diff) | |
download | redmine-b99c3caae8b40df163612e5d1461705a9d16fdb2.tar.gz redmine-b99c3caae8b40df163612e5d1461705a9d16fdb2.zip |
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
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/10-patches.rb | 24 |
1 files changed, 0 insertions, 24 deletions
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 |