avram
                                
                                
                                
                                    avram copied to clipboard
                            
                            
                            
                        Confusing error when calling the wrong preload method
I'm getting this error, but haven't figured out why yet.
A User has_one stream_approval : StreamApproval
web          |
web          |  141 | UserSerializer.new(UserQuery.new.preload_stream_approval(current_user))
web          |                                         ^----------------------
web          | Error: no overload matches 'UserQuery#preload_stream_approval' with type User
web          |
web          | Overloads are:
web          |  - User::BaseQuery#preload_stream_approval(preload_query : StreamApproval::BaseQuery)
web          |  - User::BaseQuery#preload_stream_approval()
web          |
web          | ---
The strange thing is that it only shows these two overloads, but there's 8 different versions of this method.
@jwoertink You're using the instance method of preload with would return a new user with those associations. You want to use the class level methods to add the preloads to an existing association.
UserQuery.preload_stream_approval(current_user)
                                    
                                    
                                    
                                
ohh haha. Ok. Maybe we can figure out a way to make that error message better 🤔