I have two models
Board
has_one :pref, :autosave => true, :dependent => :destroy
Pref
belongs_to :board
The pref object has defaults that are set in the database so no information needs to be used to create the object when the board is created. The ID for the board is in the pref table.
Since the :autosave=> true I thought that when I create and save a new Board object a pref object would be created and saved automatically.
This is not working this way so I must be misunderstanding.
Is there a way to autosave a pref object when a board is saved?
Thank you in advance
autosave => true
should not create an element for you. The docs say:You could use a callback to create the
pref
object when you're creating a newboard
.Something along the lines of: