I'm having issues showing out all of my drinks in my index.html.haml. I have recently moved to start using thinking sphinx for searching after watching Ryan Bates' (thinking sphinx railscast. As part of the move to sphinx I changed @drinks = Drink.all
to @drinks = Drink.search(params[:search])
and now its not showing the drink names on my index page
Drink Model
class Drink < ActiveRecord::Base
attr_accessible :name, :detail, :recipe_steps_attributes
has_many :recipe_steps, :dependent => :destroy
has_many :ingredients, through: :recipe_steps
has_one :glass
validates_uniqueness_of :name, case_sensitive: false
accepts_nested_attributes_for :recipe_steps, :reject_if => lambda { |a| a[:amount].blank? }, :allow_destroy => true
define_index do
indexes :name
indexes ingredients.name as: :ingredient_name
end
end
Drink Controller index
def index
@drinks = Drink.search(params[:search])
if current_user
@cabinet = Cabinet.find(current_user.id)
end
end
Drink index.haml
= form_tag drinks_path, method: :get do
.field
= text_field_tag :search, params[:search]
= submit_tag "Search", name: nil
- @drinks.each do |drink|
= drink.name