Sha256: 525da87a95a14ceb6bc0a02ed916535aa43fee7b96b54e0ad01bf9b02f5f9f58
Contents?: true
Size: 521 Bytes
Versions: 2
Compression:
Stored size: 521 Bytes
Contents
class Post < ActiveRecord::Base belongs_to :category belongs_to :writer has_many :comments if Rails.version.to_i == 2 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bullet-4.1.0 | spec/models/post.rb |
bullet-4.0.0 | spec/models/post.rb |