Sha256: ca59b0576ac8864e3e2d8a45898350ce4c33a45f10a7964d81883c046f9d6a76

Contents?: true

Size: 495 Bytes

Versions: 2

Compression:

Stored size: 495 Bytes

Contents

# frozen_string_literal: true

class Product < ActiveRecord::Base
  has_many :variations, class_name: 'ProductVariation', inverse_of: :product

  validates :title, presence: true

  searchable do |o|
    o.relation :variations, :title, :stock_status

    o.attribute :title
    o.attribute :description
    o.attribute :rating, unkeyed: false
    o.attribute :title_length, unkeyed: false do
      Arel::Nodes::NamedFunction.new('LENGTH', [
        arel_table[:title]
      ])
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pursuit-0.3.1 spec/internal/app/models/product.rb
pursuit-0.3.0 spec/internal/app/models/product.rb