onfido / tradesman

Tradesman lets you invoke human-readable classes that handle the pass, fail, and invalid cases of common create, update, and delete actions.
MIT License
4 stars 1 forks source link

Support polymorphic associations #2

Open SofianO opened 9 years ago

SofianO commented 9 years ago

At the moment, when trying to pass a polymorphic association for a create

Tradesman::CreateImage.go(imageable: user)

This raises a NoMethodError: undefined method `primary_key' for Horza::Entities::SingleWithActiveModel:Class

newton101 commented 9 years ago

What model are you trying to create? I just successfully created a record with a polymorphic association as follows:

Tradesman::CreateSchemePrice.go({priceable: package_variant,...)
SofianO commented 9 years ago

This will work if package_variant is an active record but not a Horza Entity.