I have these code in my rails 3.2 application
User.includes(:profile).limit(10)
which select all fields from profiles table I need a way to select on specific fields from profiles table to decrease db queries I am using postgresql
You're better of using something like
User.joins(:profile).select("users.*, profiles.field1, profiles.field2").limit(10)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With