This came about as an observed violation of principle of least surprise (on the basis that I saw someone in the process of being surprised). I explained that it was not necessary to load a parent resource to create a new child, because you can just do Child.create(:parent_id => parent_id).
To me, there's something not quite right here. What if this new child makes the parent invalid? Then there's a back-door to making a resource invalid.
WDYT about making setting parent ids load the parent resource? Is that a good idea? Could there be any problems? Is there another way of making the behaviour less surprising?
Created by Ashley Moran - 2009-07-19 13:30:56 UTC
Original Lighthouse ticket: http://datamapper.lighthouseapp.com/projects/20609/tickets/982
该提问来源于开源项目:datamapper/dm-core