Skip to content

Instantly share code, notes, and snippets.

@timuruski
Created August 29, 2011 19:14
Show Gist options
  • Select an option

  • Save timuruski/1179153 to your computer and use it in GitHub Desktop.

Select an option

Save timuruski/1179153 to your computer and use it in GitHub Desktop.
class Externalsource
include MongoMapper::Document
one :media_asset, :as => :icon
end
class List
include MongoMapper::Document
one :media_asset, :as => :icon
end
# Assets
class MediaAsset
include MongoMapper::Document
many :device_specific_assets
end
class DeviceSpecificAsset < CloudAsset
include MongoMapper::EmbeddedDocument # to illustrate
belongs_to :device_profile
def for_device(device_profile)
device_assets.where(:device_profile => device_profile)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment