Hi people, I'm trying to use the auto_complete plugin in rails 2.3.2 for
searching from two tables. I've researched a lot but I can't make it
work. This is my code:

------- Application Controller: -------

class ApplicationController < ActionController::Base
  ...
  auto_complete_for :tutor, :name
  ...
protected

  def auto_complete_for_tutor_name
    @tutors = Tutor.find(:all, :conditions => ["enabled = 't' AND
LOWER(name) LIKE ?", "%#{params[:tutor][:name]}%"], :limit => 10)
    @courses = Course.find(:all, :conditions => ["enabled = 't' AND
LOWER(name) LIKE ? OR LOWER(code) LIKE ?", "%#{params[:tutor][:name]}%",
"%#{params[:tutor][:name]}%"], :limit => 10)
    render :inline => "<%= auto_complete_result(@tuto...@courses, :name)
%>"
  end

end

------- Form View: -------

<%= text_field_with_auto_complete :tutor, :name, {:autocomplete =>
"off"}, {:skip_style => true} %>


------- ------- -------

The point is that if I delete my "custom" auto_complete_for_tutor_name
method from the controller it works, for tutors names only of course.
What am I doing wrong ?
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to