{"action":"opened","issue":{"url":"https://api.github.com/repos/luckyframework/lucky_record/issues/265","repository_url":"https://api.github.com/repos/luckyframework/lucky_record","labels_url":"https://api.github.com/repos/luckyframework/lucky_record/issues/265/labels{/name}","comments_url":"https://api.github.com/repos/luckyframework/lucky_record/issues/265/comments","events_url":"https://api.github.com/repos/luckyframework/lucky_record/issues/265/events","html_url":"https://github.com/luckyframework/lucky_record/issues/265","id":341315270,"node_id":"MDU6SXNzdWUzNDEzMTUyNzA=","number":265,"title":"undefined constant error for association defition","user":{"login":"sdzyba","id":5605160,"node_id":"MDQ6VXNlcjU2MDUxNjA=","avatar_url":"https://avatars3.githubusercontent.com/u/5605160?v=4","gravatar_id":"","url":"https://api.github.com/users/sdzyba","html_url":"https://github.com/sdzyba","followers_url":"https://api.github.com/users/sdzyba/followers","following_url":"https://api.github.com/users/sdzyba/following{/other_user}","gists_url":"https://api.github.com/users/sdzyba/gists{/gist_id}","starred_url":"https://api.github.com/users/sdzyba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdzyba/subscriptions","organizations_url":"https://api.github.com/users/sdzyba/orgs","repos_url":"https://api.github.com/users/sdzyba/repos","events_url":"https://api.github.com/users/sdzyba/events{/privacy}","received_events_url":"https://api.github.com/users/sdzyba/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-15T11:52:53Z","updated_at":"2018-07-15T11:52:53Z","closed_at":null,"author_association":"NONE","body":"Crystal version: 0.25.1\r\nLuckyRecord version: 0.6.0\r\n\r\nWhen two models `A` and `B` are defined in the project and model `A` is associated to `B` like so:\r\n```\r\ntable :a do\r\n  ...\r\n  belongs_to b : B\r\nend\r\n```\r\nuser would get a `undefined constant B` error.\r\n\r\nMy guess is that model files are read in alphabetical order and while parsing model `A` the required model `B` is not loaded yet.\r\n\r\nWorkaround: add `require \"./b\"` at the top of model `A` definition file."}}
{"actor":{"display_login":"sdzyba"}}