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 almost 6 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

Also available in: Atom PDF