Haven't been able to find this raised before but I'm sure it must have
been. When assigning an object to a belongs_to association I would
like it to call the *association*_id= method instead of directly
updating the attributes array. This is because I want to modify the
behaviour when assigning a particular object without writing separate
methods for whether it's just an ID being assigned or a full object.
a = Author.find(2)
b = Book.new
b.author = a # Should call b.author_id=(val)
Is there already a simple way to achieve this? (without having to run
Changing it would be a one-line patch, but can anyone think of
problems this would introduce?