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
remove base class from belongs_to polymorphic association #21385
Conversation
This is related to (but not the same issue as) the whole gang of issues referenced here on #20893. It's different because |
+1 Would love to see this be merged in. |
Please rebase. |
cbb5064
to
0c49ebd
Compare
Done |
@rafaelfranca WDYT ? I think the use case make sense. I am curious tho if you can think a situation why this would not work. |
@maclover7 @rafaelfranca - Any suggestions on this.? |
Was just bitten by this today. The behaviour suggested in the PR seems like it's the most obvious. You build an association off of a subclass, the type column should be that subclass. This is especially useful if the original record is no longer available to read the type from (I'm restoring deleted records) |
I was also bitten by this this week. I have a model class that extends a class from a gem. The base class name from the gem is being inserted into the polymorphic |
+1 😁 |
+1 👍 |
any update on this if this is planned to be merged in near future |
Can you rebase the branch? |
0c49ebd
to
335fb98
Compare
@dilpreet92 sorry i am not able to see build error on codeclimate. looks like i its not an open port. let me know if you need spare hand to fix this and getting see in master like me |
@ajays1991 sure, thanks for the help |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Fix polymorphic true with inheritance.
Before this PR, it is used to store in type column the class which is directly inherited from the AR::Base.
Example:
After this change, type column can have any class (descendant of the AR::Base)
Now attachable_type can be Post, GuestPost or MemberPost
Example: