You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to edit a record whose model is associated with another model, I'm hitting the following error:
Showing ruby/3.1.0/lib/ruby/gems/3.1.0/gems/madmin-1.2.7/app/views/madmin/fields/has_many/_form.html.erb where line #4 raised: PG::AmbiguousColumn: ERROR: column reference "created_at" is ambiguous LINE 1: ..."."list_id" WHERE "stars"."user_id" = $1 ORDER BY created_at...
The issue is pointing at that created_at. Then it cites line 768:
@connection.exec_params(sql,type_casted_binds)
The sql var passed into the exec_params method is:
SELECTlists.idFROM lists INNER JOIN stars ONlists.id=stars.list_idWHEREstars.user_id= $1ORDER BY created_at DESC
This query is coming from an association on the List model, which reads:
Given the previous association definition had not caused any issues throughout the rest of my app, you may consider this an issue to address. If you don't, makes sense: I'm also putting this hear for any future Googlers.
The text was updated successfully, but these errors were encountered:
When attempting to edit a record whose model is associated with another model, I'm hitting the following error:
The issue is pointing at that
created_at
. Then it cites line 768:The
sql
var passed into theexec_params
method is:This query is coming from an association on the
List
model, which reads:I was able to fix this issue on my end by updating the order clause, like so:
Given the previous association definition had not caused any issues throughout the rest of my app, you may consider this an issue to address. If you don't, makes sense: I'm also putting this hear for any future Googlers.
The text was updated successfully, but these errors were encountered: