Skip to content

Add the ability to customize the key used for the instance in the bro… #741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

basabin54
Copy link

For certain applications, like when using STI, it can be useful to be able to change the key that is used for the instance in the broadcast locals when trying to reuse partials or displaying tables with a mix of records that are in the same database table but have a different STI subclass. This PR uses a similar approach to broadcast_target_default, preserving the default but allowing it to be easily changed in the model.

@OutlawAndy
Copy link

I believe defining an explicit self.model_name method in your STI superclass, is the idiomatic way to resolve the issue you're describing. The comment on line 519 also says something to that affect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants