Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails3 nested has_many through question

We are planning to upgrade our application to Rails3. One plugin we've used quite a bit is nested_has_many_through. This plugin seems outdated, and no longer maintained, and simply does not appear to be working in a new Rails3 application.

A simple example:

Author.rb
has_many :posts
has_many :categories, :through => :posts, :uniq => true
has_many :related_posts, :through => :categories

Post.rb
belongs_to :author
belongs_to :category

Category.rb
has_many :posts

Can anyone recommend the best practice way to handle this, or a working Rails3 plugin?

Thanks!!

like image 267
releod Avatar asked Sep 05 '10 03:09

releod


1 Answers

This is built in with Rails 3.1: http://asciicasts.com/episodes/265-rails-3-1-overview

like image 111
David Phillips Avatar answered Jan 01 '23 21:01

David Phillips