Skip to content

Commit

Permalink
Revert deprecation of sanitize_sql_hash_for_assignment
Browse files Browse the repository at this point in the history
This method is still used by `update_all`
  • Loading branch information
sgrif committed Nov 2, 2014
1 parent eb92100 commit d5902c9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
5 changes: 2 additions & 3 deletions activerecord/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.

Copy link
@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.

Copy link
@sgrif

sgrif Dec 1, 2014

Author Contributor

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.

Copy link
@thejchap

thejchap Dec 1, 2014

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

This comment has been minimized.

This comment has been minimized.

Copy link
@sgrif

sgrif via email Dec 2, 2014

Author Contributor

*Sean Griffin*

Expand Down
3 changes: 0 additions & 3 deletions activerecord/lib/active_record/sanitization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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])}"
Expand Down

0 comments on commit d5902c9

Please sign in to comment.