Skip to content
This repository has been archived by the owner on Oct 19, 2018. It is now read-only.

fix Collection#set_belongs_to to work with has_many through #83

Open
catmando opened this issue Mar 13, 2018 · 0 comments
Open

fix Collection#set_belongs_to to work with has_many through #83

catmando opened this issue Mar 13, 2018 · 0 comments

Comments

@catmando
Copy link
Contributor

catmando commented Mar 13, 2018

probably means complete refactor of has_many_through.

What has_many_through should probably be doing is something like this:

Consider TodoItems.has_many :commenters, class: User, through: :comments

todo_item.commenters.first => todo_item.comments.first.user

In other words it asks just like a scope on Comment, but with the special property that the user (belongs_to) method is automatically applied.

probably its much easier to do this via some delegation class on top of the Comment all scope rather than all the complex mechanism currently.

Right now Collection#set_belongs_to is failing on most recent edge because of the removal of the method_missing which was allowing a bogus assignment to work. For now this has been patched up so it at least works for existing code.

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

No branches or pull requests

1 participant