Sha256: 7f68cae547903ca03a1cc8bbf1361a624e78d55264d21d96f41bd6757b935a01

Contents?: true

Size: 402 Bytes

Versions: 8

Compression:

Stored size: 402 Bytes

Contents

# frozen_string_literal: true

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

  has_and_belongs_to_many :genres

  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-4.4.1 spec/internal/app/models/book.rb
thinking-sphinx-4.4.0 spec/internal/app/models/book.rb
thinking-sphinx-4.3.2 spec/internal/app/models/book.rb
thinking-sphinx-4.3.1 spec/internal/app/models/book.rb
thinking-sphinx-4.3.0 spec/internal/app/models/book.rb
thinking-sphinx-4.2.0 spec/internal/app/models/book.rb
thinking-sphinx-4.1.0 spec/internal/app/models/book.rb
thinking-sphinx-4.0.0 spec/internal/app/models/book.rb