Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error en Match: marked_for_destruction? #93

Open
GSegov1a opened this issue Mar 28, 2024 · 1 comment
Open

Error en Match: marked_for_destruction? #93

GSegov1a opened this issue Mar 28, 2024 · 1 comment

Comments

@GSegov1a
Copy link

En el modelo de Match, tengo el atributo teamA_id y teamB_id, pero en la pauta se nos especifica que debe ser teamA y teamB, entonces para solucionarlo use el código de alias_attribute.
image
El problema es que cuando lo ejecuto (sin los # evidentemente), se me genera el siguiente error.
image
Si es que quito el código de alias_attribute vuelve a funcionar todo con normalidad.
Llevo rato buscando y no se que es lo que falla.

@jpsandoval
Copy link

si, recomendaria no usar el alias_attribute, y crear los objetos manualmente.

Por ejemplo, te llega un json "match": {"teamA":2 ....}

m = Match.new(....)
m.teamA = Team.find(params[:team][:teamA])

params[:team][:teamA] note que esta linea devuelve el valor del json.
Con el valor puedo inicializar el Match como corresponde...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants