Use AR model associations instead of querying by issue_id
refactoring
fix some NoMethodErrors

Were introduced by me just now. Whoops