I just generated a scaffold. I added has_many :posts to the user.rb and added belongs_to :user to the post.rb. But now when i try to create a new post it tells me that an error occurred and that *user must exist? Anyone know how to solve this?
Asked
Active
Viewed 48 times
0
-
please post relevant code.. – Ren Jul 18 '16 at 16:32
-
you need to add the user to the post you're creating or allow to pass a nil user to the association – neydroid Jul 18 '16 at 16:33