gpt-3.5-turbo-0301· OpenAI
WildChat-4.8M (AI2)
I have a Rails app with a User model that has_one :profile. How do i select only those…
- User
I have a Rails app with a User model that has_one :profile. How do i select only those users who have a profile that has status: "live"
- Assistant
You can use the joins method to join the User and Profile tables, and then use the where method to filter the results by the live status. Here's an example query:
codeUser.joins(:profile).where(profiles: {status: "live"})This will return a list of all users who have a profile with a status of "live".