maccman / supermodel

Ruby in-memory models

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

If SuperModel support relationships? like belong_to or has_many.

shaoyangyu opened this issue · comments

Hi

Not sure if SuperModel supoort relationships, like belong_to or has_many.

class Person
has_many:addresses
end
.....
person.addresses = [ address ]
person.addresses.target #=> returns [ address ]
person.addresses.base #=> returns person
person.addresses.metadata #=> returns the metadata
.....

Yes, I'm using belongs_to in a Supermodel model in my project with great success. The readme is pretty light, so I recommend checking the RDoc for such things.

thanks ~