Hi, guys.
I’m having trouble setting this polymorphic association
say that i have this setup
class User
has_one :face_photo, as: :imageable, class_name: “Image”, dependent:
:destroy
has_one :body_photo, as: :imageable, class_name: “Image”, dependent:
:destroy
end
class Image
belongs_to :imageable, polymorphic: true
end
Both face_photo and body_photo are being saved with the images table
with
the imageable_type == “User”, so when i try to get body_photo from a
user,
it brings me its face_photo.
Is there a way i can specify the type that goes in the imageable type so
it
can bring me the right image?