ActiveRecord includes. Specify included columns

Rails doesn’t have the facility to pass the options for include query. But we can pass these params with the association declaration under the model.

For your scenario, you need to create a new association with users model under the profile model, like below

belongs_to :user_only_fetch_email, :select => ",", :class_name => "User"

I just created one more association but it points to User model only. So your query will be,




Leave a Comment