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?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to