Using Rails 2.3.8. I wanna show data from complicated relationship.
These are in my models:
shop.rb
has_many :city_shops
id | name
3 | Good Cafe
city_shop.rb
belongs_to :city
belongs_to :shop
id | city_id | shop_id | notes
2 | 4 | 3 | Delicious food in Paris
city.rb
belongs_to :article
has_many :city_shops
has_many :shops, :through => :city_shops
id | article_id
4 | 5
article.rb
has_many :shops, :through => :shop_articles
has_many :cities, :dependent => :destroy
id | user_id | name
5 | 6 | Favorite shops in France
user.rb
has_many :articles
id | login
6 | victor
The scenario is this (may not be logical):
A user with ID 6 creates many articles. Let's say he creates this article called Favorite shops in France. In this article, there are cities. In each city, there are city_shops where in it there are details shop and notes from city_shops.
I also have individual shop page. I want the visitors to know what notes have been left by users, where the note is and the link to that user's article.
In the shop page, it should read:
Notes by users "Delicious food in Paris" by "victor", shared in "link to favorite shops in France".
I hope this question is clearer than previous. Thank you very much.