Project

General

Profile

Refactor #6878

Replace default_scope with specific scopes for visibility

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

Status:
New
Priority:
Normal
Assignee:
-
Category:
Rails
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
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

Related to Foreman - Bug #6873: Error during db:seed from 1.4 to 1.6: undefined method `expire_topbar_cache' for nil:NilClassClosed2014-08-01
Related to Foreman - Bug #6964: Error on startup: "null value in column "user_id" violates not-null constraint"Closed2014-08-06

History

#1 Updated by Dominic Cleal over 7 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

#2 Updated by The Foreman Bot over 7 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 ()

#3 Updated by Dominic Cleal over 7 years ago

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

#4 Updated by Dominic Cleal over 7 years ago

  • Assignee set to Dominic Cleal
  • Legacy Backlogs Release (now unused) set to 10

#5 Updated by Dominic Cleal over 7 years ago

  • Status changed from Ready For Testing to New
  • Assignee deleted (Dominic Cleal)
  • Target version deleted (1.7.5)
  • Legacy Backlogs Release (now unused) 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.

#6 Updated by Dominic Cleal over 7 years ago

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

#7 Updated by Dominic Cleal over 7 years ago

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

Also available in: Atom PDF