Use correct name for foreign key.
Do not use nested attributes and save files with build function.
Add public folder to gitignore.