Hi friend

u can try this one..There are three tables :Library,Author,book

Class Library <ActiveRecord::Base
has_many :Authors
has_many :Books
end

Class Author <ActiveRecord::Base
belongs_to :library
has_many :books
end

Class Book <ActiveRecord::Base
belongs_to :library
belongs_to :author
end


On Tue, Oct 20, 2009 at 8:46 PM, Serafino Picozzi <
rails-mailing-l...@andreas-s.net> wrote:

>
> Hi everyone, I have the following problem, maybe someone can help me
> figure out what to do.
>
> To simplify my situation, I'm going to make an example of what I need,
> this is not the real app structure.
>
> Let's suppose we have three models, Library, Author, Book.
>
> Manager
> has_and_belongs_to_many :area_managers
>
> AreaManager
> has_and_belongs_to_many :managers
> has_many :employees
>
> Employee
> belongs_to :area_manager
>
>
> Given a manager, I'd like to find all the employees under its area
> managers in a single query.
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to