I\'m trying to find a record by associated username which is included in a belongs_to relation, but it\'s not working.
Articles belong to Users Users have many artic
You can make it little shorter from what rubish suggested:
user_ids = User.where(username: 'erebus').pluck(:id) articles = Article.where(:user_id.in => user_ids)
Or one liner:
articles = Article.where(:user_id.in => User.where(username: 'erebus').pluck(:id))