clowne-rb/clowne

Plans to support belongs to and has many through?

Closed this issue · 1 comments

Hello,

Thanks for the gem are there any plans to support belongs to or has_many through associations?

I just hacked together an implementation for belongs_to:

https://gist.github.com/daniel-rikowski/790e07db36a00925f653714f9c66f20c

Caution: It was rather easy, so it's quite possible I missed something important.

Usage: include_belongs_to :author

If you need has_many through you can just clone the through association (the one without the through option). Unfortunately you have to save and reload the model in order to update the parent association (the one with the through option)