/ Published in: Rails

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
class Post < ActiveRecord::Base has_many :comments named_scope :commented_by, lambda { |user_id| { :joins => :comments, :conditions => ["comments.user_id = ?", user_id] } } end class Comment < ActiveRecord::Base belongs_to :user belongs_to :post end
Comments
