`
orcl_zhang
  • 浏览: 244693 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Namedscoped

阅读更多
  class Picture < ActiveRecord::Base
    has_many :most_recent_comments, :class_name => 'Comment', :order => 'id DESC', :limit => 10
  end

  Picture.find(:first, :include => :most_recent_comments).most_recent_comments # => returns all associated comments.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics