small medium large xlarge

Generic-user-small
14 Dec 2010, 01:52
Aaron mcLeod (13 posts)

Posted this on railsforum, but no luck. Wondering if you guys can perhaps help me out.

I implemented the playtime task of converting payment_types to a model. I have it working on the website, however I cannot seem to get my unit tests and therefore functional tests working. When i pull a fixture of an order, and loop through the error messages, there are not. Yet assert @order.valid? fails. Any assistance would be greatly appreciated.

https://gist.github.com/739893

Generic-user-small
18 Dec 2010, 20:48
Aaron mcLeod (13 posts)

Solved! :D

Found a solution online when i started looking into doing units tests with validates_inclusion_of. Since it’s an association, the solution is to use:

validates_associated :payment_type

Makes sense really, as validates_inclusion_of is more for an array local to the model, not another model.

You must be logged in to comment