Displaying 1 result from an estimated 1 matches for "sca_nam".
Did you mean:
scanam
2013 Mar 05
4
searching model and has_one association
Howdy.
I have these models:
User, field "mundane_name"
user has_one :instructor_profile (may or may not exist)
instructor_profile, field "sca_name"
belongs_to :user
I would like to craft a search on these fields, which is effectively this,
but in one go:
matching_users = User.where("mundane_name ILIKE ?", "%#{target}%")
matching_profiles = InstructorProfile.where("sca_name ILIKE ?",
"%#{target}%"...