Skip to content

Instantly share code, notes, and snippets.

View hanka's full-sized avatar

Hanna Seweryn hanka

View GitHub Profile

Keybase proof

I hereby claim:

  • I am hanka on github.
  • I am hanna_urbit (https://keybase.io/hanna_urbit) on keybase.
  • I have a public key ASCux6hUFB95Stwzg0yZbhF_r5_4cWN4B2W_CgveBuH0Pwo

To claim this, I am signing this object:

remove_polymorphic_foreign_key :images, :users, column: :imageable
add_polymorphic_foreign_key :images, :users, column: :imageable
add_polymorphic_foreign_key :images, :items, column: :imageable
@hanka
hanka / user.rb
Last active August 29, 2015 14:17
class User < ActiveRecord::Base
has_many :images, as: :imageable
end
@hanka
hanka / item.rb
Last active August 29, 2015 14:17
class Item < ActiveRecord::Base
has_many :images, as: :imageable
end
class Image < ActiveRecord::Base
belongs_to :imageable, polymorphic: true
end