Retain selections with `includes` and `joins`
Applying `includes` and `joins` to a relation that selected additional database fields would cause those additional fields not to be included in the results even though they were queried from the database: posts = Post.select('1 as other').includes(:tbl).joins(:tbl) posts.to_sql.include?('1 as other') #=> true posts.first.attributes.include?('other') #=> false This commit includes these additionally selected fields in the instantiated results.
Showing
想要评论请 注册 或 登录