In particular, suppose we have two reasonable models:
TieDyeCentipede, which the has_many :legsLegwhich has an attribute :color.
Being TieDyeCentipede, no two legs have the same color. In fact, the special color of the legs is unique among all the feet of all our TieDyeCentipedes.
Based on this uniqueness, we want to find a specific one with a Centipedespecial color of legs - say :deep_sky_blue.
I could do something like:
critter = Leg.find_by_color(:deep_sky_blue).tie_dye_centipede
However, is there a method find_by_*in the class TieDyeCentipedethat I could use?
source
share