I have two models
class User < ActiveRecord::Base
has_one :work
end
class Work < ActiveRecord::Base
belongs_to :user
end
I need to have distinct description from Work table for specific country’s users
I have written following query
Work.includes(:user).where("users.country_name = ?",'IN').select("distinct works.description").limit(10)
It works but it does not give me distinct works.description
It worked with following query,