gist: 12618 Download_button fork
public
Public Clone URL: git://gist.github.com/12618.git
Text only
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#project.rb
has_many :usages
has_many :asset_orders
has_many :usages, :through => :requests
 
#request.rb
belongs_to :project
 
#usage.rb
belongs_to :request
belongs_to :asset
has_and_belongs_to_many :asset_orders
 
#asset.rb
has_many_polymorphs :holdables, :from => [:clients, :vendors], :through => :licenses
 
#asset_order.rb
belongs_to :project
has_and_belongs_to_many :usages
 
#vendor.rb
has_many :licenses, :as => :holdable
 
#license.rb
belongs_to :vendor, :polymorphic => true
belongs_to :assets
 
Vendor.find(
  :all,
  :include => {:license => {:asset => {:usages => {:asset_orders}}}},
  :conditions => "asset_orders.id IS NOT NULL"
)
 
 

Owner

AndrewO

Fork Of

Revisions