Displaying 1 result from an estimated 1 matches for "some_invalid_id".
2006 Jun 13
6
Dead horse: validates_associated
..._to :author
validates_associated :author
But I DON''T have validates_presence_of. What I want to do is validate
that an author is valid --if it is specified--.
+ I want to allow for the case where article.author_id = nil.
+ I DO NOT want to allow for the case where article.author_id =
SOME_INVALID_ID
During testing, I tried this:
article = Article.new
article.author_id = nil
assert c.valid? (True -- working so far)
article.author_id = 5
assert c.valid? (True -- because author 5 is valid)
article.author_id = 999
assert c.valid? (True!?! -- shouldn'...