Skip to content

Instantly share code, notes, and snippets.

Created February 7, 2017 02:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/35fc024590a7aa943ea041598070c99c to your computer and use it in GitHub Desktop.
Save anonymous/35fc024590a7aa943ea041598070c99c 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
if self.children.exists?(:status => "active")
return true
else
return false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment