2009/10/20 Serafino Picozzi <rails-mailing-l...@andreas-s.net>:
>
> 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

I think this will work, though I am not quite sure given this a habtm
rather than has_many. Include here
has_many :employees, :through => :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.

@employees = @manager.employees

Colin

> --
> 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