Skip to content

Instantly share code, notes, and snippets.

@jgonera
Created August 29, 2011 14:28
Show Gist options
  • Select an option

  • Save jgonera/1178503 to your computer and use it in GitHub Desktop.

Select an option

Save jgonera/1178503 to your computer and use it in GitHub Desktop.
# project.rb
class Store
include Mongoid::Document
end
class Project
include Mongoid::Document
field :name
embeds_one :store, as: :project
end
# dropbox_store.rb
require 'project'
class DropboxStore < Store
#include Mongoid::Document
field :session
field :path
embedded_in :project, polymorphic: true
validates_presence_of :path
after_initialize :load_session
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment