Created
February 13, 2009 04:05
-
-
Save Sutto/63042 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Goal is => Client.first.items... Can do with finder_sql, but want an activerecord way! | |
class Client < ActiveRecord::Base | |
has_many :contacts | |
has_many :tasks, :through => :contacts | |
has_many :items, :through => :contacts # THIS DOESNT WORK | |
end | |
class Contact < ActiveRecord::Base | |
belongs_to :client | |
has_many :tasks | |
has_many :items, :through => :tasks | |
end | |
class Task < ActiveRecord::Base | |
belongs_to :contact | |
has_many :items | |
end | |
class Item < ActiveRecord::Base | |
belongs_to :task | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment