You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This could be my own misunderstanding about how scoping associated models is expected to configured. I have reviewed the Wiki.
Describe the bug
Let's say we have 2 models, Team and Player. Playerbelongs_to :team and Teamhas_many :players. The Player model has a default_scope which excludes "inactive" players:
The text was updated successfully, but these errors were encountered:
rnevius
changed the title
Associated records not show when associations have a default scope
Associated records not shown when associations have a default scope
Feb 29, 2024
Preface
This could be my own misunderstanding about how scoping associated models is expected to configured. I have reviewed the Wiki.
Describe the bug
Let's say we have 2 models,
Team
andPlayer
.Player
belongs_to :team
andTeam
has_many :players
. ThePlayer
model has adefault_scope
which excludes "inactive" players:Players
are unscoped and shown in the/player
route in Rails Admin, as expected:🐛 However,
Players
are not shown when viewingTeams
(list, edit, show, etc.):Reproduction steps
Demo repo: https://github.com/rnevius/rails_admin_associated_scope_demo
Relevant code is in the models.
Expected behavior
Unscoped associations should be shown.
Additional context
rails
version: 7.1.3rails_admin
version: 3.1.2rails_admin
npm package version: 3.1.2The text was updated successfully, but these errors were encountered: