Using belongs_to in Rails model validations when the parent is unsaved
Apr.26, 2008 in
programming
Can’t get there from here
In one of my Ruby on Rails projects, I have a model validation which is dependent on attributes from a belongs_to parent. Normally, you can refer to a parent model as child.parent and access the parent’s attributes as child.parent.attr. The difficulty arises when the parent object is unsaved. Let’s look at [...]
