With this model:
class Product < ActiveRecord::Base
belongs_to :category
define_index do
join category
indexes sku
indexes category.name, :as => :category_name, :facet => true
end
end
When I do:
products = Product.search("something")
products[0].category_name if products.size > 0
I get error:
NoMethodError: undefined method `category_name'
How can I fix it?