Skip to content

Instantly share code, notes, and snippets.

@radar
Forked from anonymous/test.rb
Last active February 7, 2017 02:40
Show Gist options
  • Save radar/14cf3e956fda5a80088634a4b4bf30db to your computer and use it in GitHub Desktop.
Save radar/14cf3e956fda5a80088634a4b4bf30db to your computer and use it in GitHub Desktop.
does self do an inner join on i
class Parent < ActiveRecord::Base
has_many :children
#Question: Does method below perform a join in children and match only children belonging to a specific parent?
def has_active_children
children.exists?(status: "active")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment