Here are the two models I have:
class Parent
many :children
key name
end
class Children
belongs_to :parent
key price
key description
end
I want to find all the children that have a parent with a particular name let's say test.
I could this with
Children.all.select{|a| a.parent.name == "test"}
But I would like to define a scope in the children class is that possible using where clause?
I tried with
scope :parent_name, where("parent.name" => "test")
But it does not work.