Skip to content

Instantly share code, notes, and snippets.

View tvw's full-sized avatar

Thomas Volkmar Worm tvw

  • Hamburg, Germany
View GitHub Profile
@tvw
tvw / ar_collection.rb
Created November 7, 2017 15:23
AR Collection
class MyCollection < ApplicationRecord
end
class MyCollectionObject < ApplicationRecord
end
m = MyCollection.new
m.objects << ModelA.first
m.objects << ModelB.first
m.objects << ModelX.first
m.save