Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Person
- include Mongoid::Document
- field :name
- references_many :preferences, :stored_as => :array, :inverse_of => :people
- end
- class Preference
- include Mongoid::Document
- field :name
- references_many :people, :stored_as => :array, :inverse_of => :preferences
- end
- ps1 = Person.create(:name => 'John Doe')
- pf1 = Preference.create(:name => 'Preference A')
- ps1.preferences << pf1
- ps1.preferences << pf1
Add Comment
Please, Sign In to add comment