Sha256: 302268b832f4412c2e3d9a39b4423c03b5fb43e8b2e31c98c6cb523aabb9d421

Contents?: true

Size: 476 Bytes

Versions: 8

Compression:

Stored size: 476 Bytes

Contents

# frozen_string_literal: true

class Book < ActiveRecord::Base
  include ThinkingSphinx::Scopes

  has_and_belongs_to_many :genres

  ThinkingSphinx::Callbacks.append(self, :behaviours => [:sql, :deltas])

  sphinx_scope(:by_query) { |query| query }
  sphinx_scope(:by_year) do |year|
    {:with => {:year => year}}
  end
  sphinx_scope(:by_query_and_year) do |query, year|
    [query, {:with => {:year =>year}}]
  end
  sphinx_scope(:ordered) { {:order => 'year DESC'} }
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
thinking-sphinx-5.5.1 spec/internal/app/models/book.rb
thinking-sphinx-5.5.0 spec/internal/app/models/book.rb
thinking-sphinx-5.4.0 spec/internal/app/models/book.rb
thinking-sphinx-5.3.0 spec/internal/app/models/book.rb
thinking-sphinx-5.2.1 spec/internal/app/models/book.rb
thinking-sphinx-5.2.0 spec/internal/app/models/book.rb
thinking-sphinx-5.1.0 spec/internal/app/models/book.rb
thinking-sphinx-5.0.0 spec/internal/app/models/book.rb