Sha256: 6aa1359aaafc3817b08a8f9e0abe7be199e17698d1fee440182e3de15eb45b03
Contents?: true
Size: 542 Bytes
Versions: 11
Compression:
Stored size: 542 Bytes
Contents
class Post < ActiveRecord::Base extend Bullet::Dependency belongs_to :category belongs_to :writer has_many :comments if active_record2? named_scope :preload_comments, lambda { {:include => :comments} } named_scope :in_category_name, lambda { |name| {:conditions => ['categories.name = ?', name], :include => :category} } else scope :preload_comments, lambda { includes(:comments) } scope :in_category_name, lambda { |name| where(['categories.name = ?', name]).includes(:category) } end end
Version data entries
11 entries across 11 versions & 1 rubygems