Skip to content

Instantly share code, notes, and snippets.

@iyuuya
Last active December 24, 2015 08:49
Show Gist options
  • Save iyuuya/6773484 to your computer and use it in GitHub Desktop.
Save iyuuya/6773484 to your computer and use it in GitHub Desktop.
class Image < ActiveRecord::Base
belongs_to :imageable, polymorphic: true, foreign_key: 'xxx_id', foreign_type: 'xxx_type'
end
class User < ActiveRecord::Base
has_many :image_hoge, as: :imageable, class_name: 'Image'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment