私は、所属するユーザーに作成者エンティティを持っています。ユーザー has_many の投稿。ユーザーから Author エンティティに recent_posts を表示する方法を教えてください。
class User < ActiveRecord::Base
has_many :posts, :foreign_key => "author_id"
end
class Post < ActiveRecord::Base
attr_accessible :title, :content
belongs_to :author, :class_name => "User"
end
class Author < ActiveRecord::Base
belongs_to :user
has_many :recent_posts, :through => :user,
:class_name => "Post",
:limit => 3,
:order => "updated_at desc"
end
recent_post はどのように行うべきですか? 生のSQL?