[PATCH] should_require_attributes does not work with has_many associations
Reported by Joachim Garth | August 17th, 2008 @ 06:29 AM
Short summary: ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0] Rails 2.1.0
Model Code:
has_many :groups
validates_presence_of :groups
Shoulda Test Code:
should_require_attributes :groups
=> ERROR: An error occurred while evaluating nil.each ...
Fix: See if the tested attribute is a has_many association, and instead of testing it with nil as a test value, use an empty Array. Diff is attached.
By the way: Again, I have to say shoulda really makes my day when it comes to writing tests. Thanks!
Comments and changes to this ticket
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
