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
This is issuing an INSERT of Location, then INSERT of LocationHours (with all fields except LocationId), then a SELECT on LocationHours, then an UPDATE on LocationHours (setting LocationId)...
I just want to create the LocationHours with the VenueId since it is known. How can I do this?
Thanks!
The text was updated successfully, but these errors were encountered:
It seems oddly dumb to me to create this record first, then update it... I can't find any documentation on doing this. I saw the "create_" methods in the test suite... but everywhere else, this library is doing two creates, then adding... which that in itself is too many queries. I expected the create_ behavior to do two inserts since everything is known for the association creation.
createAssociation just uses the internal methods afaik, the reasoning is most likely that the foreign key might be on another table than the specific one you're creating (this is really only a case for belongsTo as i see it - belongsTo also being the reverse of a 1:M hasMany).
If you have the id you need, you can just create the association manually:
This is issuing an INSERT of
Location
, then INSERT ofLocationHours
(with all fields exceptLocationId
), then a SELECT onLocationHours
, then an UPDATE onLocationHours
(settingLocationId
)...I just want to create the LocationHours with the VenueId since it is known. How can I do this?
Thanks!
The text was updated successfully, but these errors were encountered: