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-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---