Project

General

Profile

Actions

Refactor #6878

open

Replace default_scope with specific scopes for visibility

Added by Dominic Cleal over 10 years ago. Updated over 10 years ago.

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

Description

default_scopes have caused a few bugs, mostly around sorting as the field used for sorting may not be available when the model is used in another query. When used to restrict visibility (e.g. #3272 for hidden users and taxonomies generally), it can break Rails associations as they assume a model can be looked up by ID (#6873).

Perhaps we should move to a more generally available scopes on every model? .visible, .sorted etc?


Related issues 2 (0 open2 closed)

Related to Foreman - Bug #6873: Error during db:seed from 1.4 to 1.6: undefined method `expire_topbar_cache' for nil:NilClassClosedDominic Cleal08/01/2014Actions
Related to Foreman - Bug #6964: Error on startup: "null value in column "user_id" violates not-null constraint"ClosedDominic Cleal08/06/2014Actions
Actions #1

Updated by Dominic Cleal over 10 years ago

  • Related to Bug #6873: Error during db:seed from 1.4 to 1.6: undefined method `expire_topbar_cache' for nil:NilClass added
Actions #2

Updated by The Foreman Bot over 10 years ago

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

Updated by Dominic Cleal over 10 years ago

  • Blocks Bug #6964: Error on startup: "null value in column "user_id" violates not-null constraint" added
Actions #4

Updated by Dominic Cleal over 10 years ago

  • Assignee set to Dominic Cleal
  • Translation missing: en.field_release set to 10
Actions #5

Updated by Dominic Cleal over 10 years ago

  • Status changed from Ready For Testing to New
  • Assignee deleted (Dominic Cleal)
  • Target version deleted (1.7.5)
  • Translation missing: en.field_release deleted (10)
  • Pull request added
  • Pull request deleted (https://github.com/theforeman/foreman/pull/1665)

Didn't mean to use this bug only for users.

Actions #6

Updated by Dominic Cleal over 10 years ago

  • Blocks deleted (Bug #6964: Error on startup: "null value in column "user_id" violates not-null constraint")
Actions #7

Updated by Dominic Cleal over 10 years ago

  • Related to Bug #6964: Error on startup: "null value in column "user_id" violates not-null constraint" added
Actions

Also available in: Atom PDF