gobuffalo / buffalo-auth

Buffalo auth plugin helps adding username password authentication to your app
https://gobuffalo.io
MIT License
41 stars 28 forks source link

user signup fails if User struct has pop relationship #83

Open iateadonut opened 2 years ago

iateadonut commented 2 years ago

Just like the title says, let's say you have a user struct, and add a pop relationship (in this case from model SmartcarToken):

type User struct {
    ID           uuid.UUID `json:"id" db:"id"`
    CreatedAt    time.Time `json:"created_at" db:"created_at"`
    UpdatedAt    time.Time `json:"updated_at" db:"updated_at"`
    Email        string    `json:"email" db:"email"`
    PasswordHash string    `json:"password_hash" db:"password_hash"`

    SmartcarToken SmartcarToken `has_one:"smartcar_tokens" fk_id:"user_id"`

    Password             string `json:"-" db:"-"`
    PasswordConfirmation string `json:"-" db:"-"`
}

you get this error:

reflect: call of reflect.Value.Interface on zero Value
github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment. Otherwise, this will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment. Otherwise, this will be closed in 7 days.

sio4 commented 1 year ago

Adding has_one itself will not break the workflow of user signup. We need more information for the investigation. If you provide a real example code or fully reproducible steps, I would like to work on it.