新造物件宣告方式
若 board has_many
posts,新造物件宣告方式是:
@post = @boards.posts.build
那 book has_one
author,要怎麼宣告?
二種方式皆可
@author = @book.author.build
或
@author = @book.build_author
若 board has_many
posts,新造物件宣告方式是:
@post = @boards.posts.build
那 book has_one
author,要怎麼宣告?
二種方式皆可
@author = @book.author.build
或
@author = @book.build_author