Nic Lin's Blog

喜歡在地上打滾的 Rails Developer

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

兩種方法

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