In Rails 2.3.8, if I specify a relationship in my model as:
belongs_to :foo
Is that implicitly required now? If I want this model to always specify mymodel.foo when a new record is being validated, am I still required to use validates_p开发者_JAVA百科resence_of :foo?
No, it's not implicitly required; you need to validate the presence if needed.
Sometimes you want to have a belongs_to
relationship where the parent_id
is nullable, so these are treated as separate things.
精彩评论