Sha256: c66bb257b2994f0b4d8d924b89ea58d60605767768f89655f95ec63d8db39699
Contents?: true
Size: 300 Bytes
Versions: 3
Compression:
Stored size: 300 Bytes
Contents
class Artist include Mongoid::Document field :name has_many :songs after_create :create_songs protected def create_songs 2.times { |n| songs.create!(:title => "#{n}") } end end class Song include Mongoid::Document field :title belongs_to :artist, :inverse_of => :songs end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mongoid-1.2.14 | spec/models/callbacks.rb |
mongoid-1.2.13 | spec/models/callbacks.rb |
mongoid-1.2.12 | spec/models/callbacks.rb |