{"action":"created","issue":{"url":"https://api.github.com/repos/rails/arel/issues/424","repository_url":"https://api.github.com/repos/rails/arel","labels_url":"https://api.github.com/repos/rails/arel/issues/424/labels{/name}","comments_url":"https://api.github.com/repos/rails/arel/issues/424/comments","events_url":"https://api.github.com/repos/rails/arel/issues/424/events","html_url":"https://github.com/rails/arel/issues/424","id":147059574,"number":424,"title":"Deprecation notices are confusing me","user":{"login":"codeodor","id":23479,"avatar_url":"https://avatars.githubusercontent.com/u/23479?v=3","gravatar_id":"","url":"https://api.github.com/users/codeodor","html_url":"https://github.com/codeodor","followers_url":"https://api.github.com/users/codeodor/followers","following_url":"https://api.github.com/users/codeodor/following{/other_user}","gists_url":"https://api.github.com/users/codeodor/gists{/gist_id}","starred_url":"https://api.github.com/users/codeodor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codeodor/subscriptions","organizations_url":"https://api.github.com/users/codeodor/orgs","repos_url":"https://api.github.com/users/codeodor/repos","events_url":"https://api.github.com/users/codeodor/events{/privacy}","received_events_url":"https://api.github.com/users/codeodor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-04-08T22:54:45Z","updated_at":"2016-10-08T17:17:46Z","closed_at":null,"body":"As an example: https://github.com/rails/arel/blob/master/lib/arel/visitors/to_sql.rb#L874\r\n\r\nI think my confusion stems from the fact that even if I edit the message to include the full call stack, I don't see anything in my application's path nor my library's path that is causing the notice to be printed.\r\n\r\nI have the same issue with \"passing a column to `quote`\" and `table_exists?` -- I can't find what my code is doing that's causing it.\r\n\r\nIs it possible to put the notices closer to the source of what causes them, rather than in the call that finally executes the query?\r\n\r\n> If you are passing user input to a predicate, you must either give an appropriate type caster object to the `Arel::Table`, or manually cast the value before passing it to Arel\r\n\r\nCan this be adjusted to include an example like there is for the \"if you know the value is good\" case?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/rails/arel/issues/comments/252436845","html_url":"https://github.com/rails/arel/issues/424#issuecomment-252436845","issue_url":"https://api.github.com/repos/rails/arel/issues/424","id":252436845,"user":{"login":"codeodor","id":23479,"avatar_url":"https://avatars.githubusercontent.com/u/23479?v=3","gravatar_id":"","url":"https://api.github.com/users/codeodor","html_url":"https://github.com/codeodor","followers_url":"https://api.github.com/users/codeodor/followers","following_url":"https://api.github.com/users/codeodor/following{/other_user}","gists_url":"https://api.github.com/users/codeodor/gists{/gist_id}","starred_url":"https://api.github.com/users/codeodor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codeodor/subscriptions","organizations_url":"https://api.github.com/users/codeodor/orgs","repos_url":"https://api.github.com/users/codeodor/repos","events_url":"https://api.github.com/users/codeodor/events{/privacy}","received_events_url":"https://api.github.com/users/codeodor/received_events","type":"User","site_admin":false},"created_at":"2016-10-08T17:17:46Z","updated_at":"2016-10-08T17:17:46Z","body":"I think it is. \r\n\r\nI don't know Arel well enough to know if there is a solution to the problem though.\r\n\r\nFor example, we construct a relation in one file (file A), passing in a bad value. Then in another file (file B), we do something with the relation that causes the query to execute.\r\n\r\nBut the stack trace and deprecation message don't refer to any place (file A) that would need to change to fix the message.\r\n\r\nThis is especially awful as a gem maintainer because your own code may not be at fault and you have no way at all to know what is at fault. File A could be in any number of projects yours depends on.\r\n\r\nWhat I would propose, is that instead of having the query check the values and print the deprecation notice, it would be great if the notice could be printed when you are actually constructing the relation. That would let you know where to fix it. \r\n\r\nHowever, as I noted, I don't know Arel well enough to know whether that is doable, or if it is doable, how much effort it would be to do it. "}}
{"actor":{"display_login":"codeodor"}}