Permalink
Browse files

Revert deprecation of `sanitize_sql_hash_for_assignment`

This method is still used by `update_all`
  • Loading branch information...
sgrif committed Nov 2, 2014
1 parent eb92100 commit d5902c9e7eaba4db4e79c464d623a7d7e6e2d0e3
Showing with 2 additions and 6 deletions.
  1. +2 −3 activerecord/CHANGELOG.md
  2. +0 −3 activerecord/lib/active_record/sanitization.rb
@@ -1,6 +1,5 @@
-* Deprecate `sanitize_sql_hash_for_conditions` and
- `sanitize_sql_hash_for_assignment` without replacement. Using a `Relation`
- for performing queries and updates is the prefered API.
+* Deprecate `sanitize_sql_hash_for_conditions` without replacement. Using a
+ `Relation` for performing queries and updates is the prefered API.

This comment has been minimized.

Show comment
Hide comment
@thejchap

thejchap Dec 1, 2014

@sgrif Is there an example of the preferred method somewhere? I'm getting this on semi-trivial stuff

# self has_one whatever_thing
# whatever_thing has_many posts
self.whatever_thing.posts << Post.find_by_name("whatever")
  #=> DEPRECATION WARNING: sanitize_sql_hash_for_conditions is deprecated
@thejchap

thejchap Dec 1, 2014

@sgrif Is there an example of the preferred method somewhere? I'm getting this on semi-trivial stuff

# self has_one whatever_thing
# whatever_thing has_many posts
self.whatever_thing.posts << Post.find_by_name("whatever")
  #=> DEPRECATION WARNING: sanitize_sql_hash_for_conditions is deprecated

This comment has been minimized.

Show comment
Hide comment
@sgrif

sgrif Dec 1, 2014

Member

That code should not be generating a deprecation warning, the deprecated method is not used anywhere within the Rails framework. Do you have any gems that could be causing it? Can you create a simple rails app which demonstrates the problem, and open an issue if you do think it's happening within Rails?

@sgrif

sgrif Dec 1, 2014

Member

That code should not be generating a deprecation warning, the deprecated method is not used anywhere within the Rails framework. Do you have any gems that could be causing it? Can you create a simple rails app which demonstrates the problem, and open an issue if you do think it's happening within Rails?

This comment has been minimized.

Show comment
Hide comment
@thejchap

thejchap Dec 1, 2014

@sgrif Thanks for the speedy reply. I'll continue to investigate

@thejchap

thejchap Dec 1, 2014

@sgrif Thanks for the speedy reply. I'll continue to investigate

This comment has been minimized.

Show comment
Hide comment
@sgrif

sgrif Dec 2, 2014

Member
@sgrif

sgrif via email Dec 2, 2014

Member
*Sean Griffin*
@@ -104,9 +104,6 @@ def sanitize_sql_hash_for_conditions(attrs, default_table_name = self.table_name
# { status: nil, group_id: 1 }
# # => "status = NULL , group_id = 1"
def sanitize_sql_hash_for_assignment(attrs, table)
- ActiveSupport::Deprecation.warn(<<-EOWARN)
-sanitize_sql_hash_for_assignment is deprecated, and will be removed in Rails 5.0
- EOWARN
c = connection
attrs.map do |attr, value|
"#{c.quote_table_name_for_assignment(table, attr)} = #{quote_bound_value(value, c, columns_hash[attr.to_s])}"

0 comments on commit d5902c9

Please sign in to comment.