Evan wrote:
> Good morning.
> 
> I can not for the life of me figure out why validation of objects of
> one of my classes always fails.
> 
> http://pastebin.com/m754b5bee
> 
> The highlighted lines are where I am getting errors. The unit test
> fails on the highlighted line every time. If I
> remove :olive_oil_sources from validates_presence_of validation works
> fine.
> 
> I have also tried writing my own validate method:
> 
> if ( olive_oil_destination.nil? || olive_oil_sources.empty? )
>   errors.add_to_base("blah")
> end
> 
> which also fails even though each individual piece of the if
> expression evaluates true when run under console.
> 
> Why is this object not validating? Driving me nuts.

For each has_many in a model, Rails adds an automatic validation
check of each child object.

So is an object created as OliveOilSource.new itself valid?

-- 
Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to