Project

General

Profile

Actions

Refactor #16527

closed

Replace where_values calls on Rails scopes/relations

Added by Dominic Cleal over 7 years ago. Updated over 5 years ago.

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

Description

Rails 5 removes (https://github.com/rails/rails/commit/c414fc6) the where_values method that was present on relations, which is used in two places in Foreman:

app/models/filter.rb
72: conditions = value ? limited.where_values.join(' AND ') : unlimited.where_values.map(&:to_sql).join(' AND ')
test/functional/application_controller_subclass_test.rb
200: refute_nil actual_scope.where_values.index{|condition| condition.left.name == 'field1'}

The replacement is either to use the public/documented where_values_hash method or to introspect where_clause (but that's 5.0+ only and again, rather a private API).

Actions #1

Updated by The Foreman Bot over 7 years ago

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

Updated by Dominic Cleal over 7 years ago

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

Updated by Dominic Cleal over 7 years ago

  • translation missing: en.field_release set to 189
Actions

Also available in: Atom PDF