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

Version Path
bullet-4.5.0 spec/models/post.rb
bullet-4.4.0 spec/models/post.rb
bullet-4.3.1 spec/models/post.rb
bullet-4.3.0 spec/models/post.rb
bullet-4.2.0 spec/models/post.rb
bullet-4.1.6 spec/models/post.rb
bullet-4.1.5 spec/models/post.rb
bullet-4.1.4 spec/models/post.rb
bullet-4.1.3 spec/models/post.rb
bullet-4.1.2 spec/models/post.rb
bullet-4.1.1 spec/models/post.rb