Ruby on Rails Sunday, June 11, 2017

On Sat, Jun 10, 2017 at 6:50 PM, fugee ohu <> wrote:

> ... so I took out the Profile model

What does "took out" mean? What exactly did you do? Is it the
exact reverse of how you created that model to start with?

> ActiveRecord::InvalidForeignKey (Mysql2::Error: Cannot add or update a child
> row: a foreign key constraint fails (`socialnetworking_development`.`posts`,
> CONSTRAINT `fk_rails_cd61a4aa45` FOREIGN KEY (`user_id`) REFERENCES
> `profiles` (`id`)):

Given that you're seeing a *database-generated* error -- have you
looked at the relationships, i.e. foreign keys, in the referenced tables
in that database?

Hassan Schroeder ------------------------
twitter: @hassan
Consulting Availability : Silicon Valley or remote

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment