Nic Lin's Blog

喜歡在地上滾的工程師

board has_many posts, 新造物件宣告方式是: @post = @boards.posts.build 。那如果 book has_one :author,請問要怎麼宣告?

兩種方法

@author = @book.author.build
@author = @book.build_author
comments powered by Disqus