Project

General

Profile

Actions

Bug #11924

closed

Substitute .scoped by .where(nil) to force return relation

Added by Daniel Lobato Garcia over 8 years ago. Updated over 5 years ago.

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

Description

On Rails 4 .scoped is deprecated. Calling .all on the model returns the equivalent ActiveRecord relation object on Rails 4, but on Rails 3 it returns an Array right away.
A proper replacement we can use is where(nil) - it's ugly but it returns the same relation in both Rails 3 and 4.
We could possibly substitute these by .all after the Rails 4 migration if they feel too 'unidiomatic'.


Related issues 2 (0 open2 closed)

Related to Foreman - Tracker #3157: Rails 4.1 upgrade tasksClosed09/27/2013

Actions
Related to Foreman - Bug #12432: User edit roles tab, no roles found for admin userClosedAlon Goldboim11/10/2015Actions
Actions #1

Updated by Daniel Lobato Garcia over 8 years ago

  • Subject changed from Substitute scoped for where(nil) to force return relation to Substitute .scoped by .where(nil) to force return relation
Actions #2

Updated by The Foreman Bot over 8 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2754 added
  • Pull request deleted ()
Actions #3

Updated by Daniel Lobato Garcia over 8 years ago

Actions #4

Updated by Dominic Cleal over 8 years ago

  • Assignee set to Daniel Lobato Garcia
  • translation missing: en.field_release set to 71
Actions #5

Updated by Daniel Lobato Garcia over 8 years ago

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

Updated by Dominic Cleal over 8 years ago

  • Related to Bug #12432: User edit roles tab, no roles found for admin user added
Actions

Also available in: Atom PDF