Project

General

Profile

Actions

Refactor #13974

closed

Remove nested arrays from AR finder methods

Added by Dominic Cleal almost 9 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Rails
Target version:
Difficulty:
Triaged:
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)
Actions

Also available in: Atom PDF