hyper-mesh icon indicating copy to clipboard operation
hyper-mesh copied to clipboard

fix `Collection#set_belongs_to` to work with has_many through

Open catmando opened this issue 7 years ago • 0 comments

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.

catmando avatar Mar 13 '18 22:03 catmando