Some relations not working


#1

I have relations setup on my schema, most of which work. I have two relations on my appearance table - user_assigned_id and user_booking_id which relate to the profile table. When I do a get request on appearance with ‘*’ for the relations, they all come through except profile_by_user_assigned_id, even though user_assigned_id has a value, the relation is a null.

What am I doing wrong? The only difference between user_assigned_id and user_booking_id in the schema is that user_booking_id can’t be null, and user_assigned_id can be.

{
“id”: 3,
“cdate”: “2016-02-01 20:25:25”,
“appearDate”: “2016-06-01”,
“compensation”: 150,
“description”: “First appearance ever”,
“short_description”: “First appearance”,
“status_id”: 7,
“user_assigned_id”: 17,
“user_booking_id”: 16,
“location_id”: 3,
“appearTime”: “00:00:00”,
“compensation_negotiated”: null,
“rating”: null,
“fee_charged”: null,
“acceptance_request_by_appearance_id”: [
{
“id”: 1,
“appearance_id”: 3,
“appearing_user_id”: 15,
“counter_offer”: 150,
“cdate”: “2016-02-01 21:48:41”,
“booking_user_id”: 16,
“status”: “accepted”,
“type”: “request”
},
{
“id”: 2,
“appearance_id”: 3,
“appearing_user_id”: 15,
“counter_offer”: 150,
“cdate”: “2016-02-03 02:46:34”,
“booking_user_id”: 16,
“status”: “declined”,
“type”: “request”
}
],
“profile_by_acceptance_request”: [
{
“id”: 16,
“rating”: 1,
“lawfirm_id”: null,
“address”: null,
“city”: null,
“state”: null,
“zip”: null,
“phone”: null,
“experience”: null,
“barNumber”: null,
“stripe_account_id”: null,
“dob”: null,
“stripe_key_secret”: null,
“stripe_key_publishable”: null,
“stripe_bank”: null,
“stripe_card”: null,
“stripe_customer_id”: “cus_7pT7qeD6TQhCkk”,
“display_name”: “booking user”,
“avvo_id”: null,
“photo_url”: null,
“insured”: false,
“tin”: null,
“company”: null,
“cc_last_four”: “5556”,
“bank_last_four”: null,
“phone_cell”: null,
“referral”: “Myself”,
“hear_about_us”: “and I”
}
],
“profile_by_user_assigned_id”: null,
“location_by_location_id”: {
“id”: 3,
“name”: “North”,
“latitude”: 0,
“longitude”: 0,
“address”: “1275 North Berkeley Ave”,
“city”: “Fullerton”,
“state”: “CA”,
“zip”: “92832”,
“county_id”: 1,
“user”: null,
“fee_amount”: 0,
“fee_percent”: 0.1,
“fee_min”: 10
},
“appearance_status_by_status_id”: {
“id”: 7,
“description”: “Appearance marked completed, awaiting confirmation.”,
“name”: “Pending Completed”
},
“profile_by_user_booking_id”: {
“id”: 16,
“rating”: 1,
“lawfirm_id”: null,
“address”: null,
“city”: null,
“state”: null,
“zip”: null,
“phone”: null,
“experience”: null,
“barNumber”: null,
“stripe_account_id”: null,
“dob”: null,
“stripe_key_secret”: null,
“stripe_key_publishable”: null,
“stripe_bank”: null,
“stripe_card”: null,
“stripe_customer_id”: “cus_7pT7qeD6TQhCkk”,
“display_name”: “booking user”,
“avvo_id”: null,
“photo_url”: null,
“insured”: false,
“tin”: null,
“company”: null,
“cc_last_four”: “5556”,
“bank_last_four”: null,
“phone_cell”: null,
“referral”: “Myself”,
“hear_about_us”: “and I”
},
“appearance_status_log_by_appearance_id”: [
{
“id”: 1,
“status_id”: 2,
“appearance_id”: 3,
“comment”: null,
“cdate”: “2016-02-02 00:26:46”,
“user_id”: null
},
{
“id”: 2,
“status_id”: 2,
“appearance_id”: 3,
“comment”: null,
“cdate”: “2016-02-03 07:56:02”,
“user_id”: null
},
{
“id”: 3,
“status_id”: 7,
“appearance_id”: 3,
“comment”: null,
“cdate”: “2016-02-03 19:48:51”,
“user_id”: null
},
{
“id”: 4,
“status_id”: 4,
“appearance_id”: 3,
“comment”: null,
“cdate”: “2016-02-03 19:49:03”,
“user_id”: null
},
{
“id”: 5,
“status_id”: 4,
“appearance_id”: 3,
“comment”: null,
“cdate”: “2016-02-03 19:54:07”,
“user_id”: null
},
{
“id”: 6,
“status_id”: 4,
“appearance_id”: 3,
“comment”: null,
“cdate”: “2016-02-04 08:08:49”,
“user_id”: null
}
],
“appearance_status_by_appearance_status_log”: [
{
“id”: 2,
“description”: “Appearance accepted by a lawyer”,
“name”: “Accepted”
},
{
“id”: 4,
“description”: “Appearance requirement completed”,
“name”: “Completed”
},
{
“id”: 7,
“description”: “Appearance marked completed, awaiting confirmation.”,
“name”: “Pending Completed”
}
],
“profile_by_appearance_status_log”: []
}