3

I'm not sure how I get my products to index because I think thats why I get this error:

Tire::Search::SearchRequestFailed in SearchController#results

404 : {"error":"IndexMissingException[[products] missing]","status":404}

Here is my Products Model:

class Product < ActiveRecord::Base
  attr_accessible :name, :description
  belongs_to :user

  include Tire::Model::Search
  include Tire::Model::Callbacks

  def self.search(params)
     tire.search(load: true, page: params[:page], per_page: 10) do
        query { string params[:query]} if params[:query].present?
     end
  end
end

How do I index my products if this is the issue?

Thank you.

LearningRoR
  • 26,582
  • 22
  • 85
  • 150

1 Answers1

12

Run the following rake task

rake environment tire:import CLASS='Product' 
Sebastián Palma
  • 32,692
  • 6
  • 40
  • 59
delagroove
  • 277
  • 3
  • 8