Colin Law wrote in post #954645:
>
> Are the reverse relationships has_many or belongs_to?
>
> Colin

Yes, sure.
A <--belongs_to- B <--belongs_to- C <--belongs_to- D

2Steve.

Here you have a right solution, but this code should be written in
controller. In this case, I could easily run through all records and
calculate the Model A`s state.

Anyway, for 3 model structure there is actually a solution. Here it is:
#Model C definition
belongs_to :model_b

#Model B definition
has_many :model_c
belongs_to :model_a

#Model A definition
has_many :model_b
-->has_many :model_c, :through => :model_b

Max Reznichenko

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to