Skip to content

Instantly share code, notes, and snippets.

@WaYdotNET
Created September 20, 2010 07:57
Show Gist options
  • Save WaYdotNET/587570 to your computer and use it in GitHub Desktop.
Save WaYdotNET/587570 to your computer and use it in GitHub Desktop.
class Component
include DataMapper::Resource
property :id, Serial
property :nome, String
property :descrizione, Text
property :prezzo_base, Float
property :base, Boolean
has n, :plant_types, :through => Resource
belongs_to :supplier
belongs_to :component_type
end
class Supplier
include DataMapper::Resource
property :id, Serial
property :nome, String
property :ragione_sociale, String
property :piva, String
property :cf, String
has n, :components
end
class ComponentType
include DataMapper::Resource
property :id, Serial
property :nome, String
property :note, Text
has n, :components
end
class PlantType
include DataMapper::Resource
property :id, Serial
property :nome, String #, :required => true, :unique => true
has n, :components, :through => Resource
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment