I have a form where the user signs up and creates an Account, an User and a Website.
def new
@account = Account.new
@account.users.build
@account.websites.build
...
end
def create
@account = Account.new(params[:account])
...
Everything works fine. Now, I want to create a default Page with Page.title = "homepage" and Page.body = "".
How can I do that? I tried different options and it doesn't work. For example, I do this @account.websites.pages.build and I get this undefined method pages for []:ActiveRecord::Relation.
@account.websites.build.pages.build@account.websites[0].pages[0].title = "homepage"