I am working on a Rails application that will contain information about a group of people. There are two use cases:
- The administrator enters and maintains the user profile
- A person can decide to register, log in and save their profile
I'm trying to figure out the relationship between a profile and a user. Right now, that profile belongs_to :userand user has_one :profile.
But this breaks down because some profiles do not yet have a user - they are supported by the administrator. In this case, the column user_idin profilesis null, the connection fails, and the page does not load. ++
How can I set up a “possibly owned” relationship?
++ (In fact, it looks empty, displays without error, and development.logalso does not have any errors, but I see that it does not finish all the requests that it performs for a profile that has If anyone knows how I can get useful error message, this will also be great.)
source
share