I’ve got these associations:
class User < ActiveRecord::Base
has_one :position
end
Class Position < ActiveRecord::Base
belongs_to :user
end
And I want to get users with positions. I tried to
User.where(:position != nil)
but it doesn’t work cause there is no position_id fileld in users table.
How can I get users with positions?
User.includes(:position).where(“positions.id IS NOT NULL”)