Я полагаю, интерфейс изменился за эти годы. поиск продолжается ...
я есть эта настройка:
Continent
->Country
->City
->Post
и я имею
class Continent < ActiveRecord::Base
has_many :countries
end
class Country < ActiveRecord::Base
belongs_to :continent
has_many :cities
end
class City < ActiveRecord::Base
belongs_to :country
has_many :posts
end
class Post < ActiveRecord::Base
belongs_to :city
end
Как я могу получить все континенты, имеющие сообщения через эту ассоциацию
Подобно:
@posts = Post.all
@posts.continents #=> [{:id=>1,:name=>"America"},{...}]