I have a model called Article with which I am joining TwitterShare, as shown below:
articles = Article.joins("LEFT OUTER JOIN twitter_shares ON articles.id = twitter_shares.article_id").where("articles.id = ? or articles.id = ?", 27165, 5632).select("articles.id, twitter_shares.user_id")
When I go back to the articles and examine the returned article model, it returns user_id as a string, even if the column type in twitter_shares is an integer. Why is this? How to get ActiveRecord to return an integer column as an integer, not a row?
source share