Hello,

Have you guys noticed that conditional validation with validates_associated 
does not work well when you are creating a new record?

Consider this gist: https://gist.github.com/aflag/4780225 

The Lawyer class has validates_associated on address conditioned on whether 
the Lawyer data comes from a known source or not. So, if lawyer.source 
equals to some string, then lawyer.address must not be validated. However, 
if I'm trying to create a new record, it is validated regardless of whether 
source is nil or not. Is it expected to behave like that? Is that a bug?

Cheers,
Rafael

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/v6vy1Yj34FwJ.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to