Project

General

Profile

Refactor #13974

Remove nested arrays from AR finder methods

Added by Dominic Cleal about 6 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Rails
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Rails 4.2 deprecates passing nested arrays to AR finders, e.g. Feature.find_by_name([['Puppet']]) should be flattened first.

This is triggered from two places in the codebase. One's in the SmartProxy.with_features call from require_smart_proxy_or_login (smart proxy auth concern) which passes an array into the scope causing nesting:

DEPRECATION WARNING: Passing a nested array to Active Record finder methods is deprecated and will be removed. Flatten your array before using it for 'IN' conditions. (called from block in <class:SmartProxy> at /home/dcleal/code/foreman/foreman/app/models/smart_proxy.rb:41)

The second is in Taxonomix:

DEPRECATION WARNING: Passing a nested array to Active Record finder methods is deprecated and will be removed. Flatten your array before using it for 'IN' conditions. (called from with_taxonomy_scope at /home/dcleal/code/foreman/foreman/app/models/concerns/taxonomix.rb:3
8)

Associated revisions

Revision f9bae424 (diff)
Added by Dominic Cleal about 6 years ago

fixes #13974 - remove nested arrays passed to AR finders

Passing a nested array to Active Record finder methods is deprecated in
Rails 4.2 and will be removed, they must be flattened first.

History

#1 Updated by The Foreman Bot about 6 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3257 added

#2 Updated by Dominic Cleal about 6 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#3 Updated by Dominic Cleal about 6 years ago

  • Legacy Backlogs Release (now unused) set to 136

Also available in: Atom PDF