Hi everyone,
I have been introduced to ruby on rails a couple of days ago and it
really brings out the fun in programming for the Web. I’m trying to
implement a text_field_with_auto_complete as described in
script.aculo.us , as follows:
controller:
class SearchController < ApplicationController
auto_complete_for :recipe, :name
end
search.rhtml:
<%= javascript_include_tag :defaults %> <%= text_field_with_auto_complete :recipe, :name %>The result, however, is an unresponsive site, with the following output
from LightHTTPd:
Processing SearchController#auto_complete_for_recipe_recipe_name (for
127.0.0.1 at 2006-06-25 18:56:27) [POST]
Session ID: 7e424000d0d368532915e019f3e2c27f
Parameters: {“action”=>“auto_complete_for_recipe_recipe_name”,
“controller”=>“search”, “recipe”=>{“recipe_name”=>“u”}}
NameError (uninitialized constant Recipe):
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in
const_missing' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in
const_missing’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/inflector.rb:161:in
constantize' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/string/inflections.rb:59:in
constantize’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/macros/auto_complete.rb:44:in
auto_complete_for_recipe_recipe_name' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:910:in
perform_action_without_filters’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in
perform_action_without_benchmark' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue’
/usr/local/lib/ruby/1.8/benchmark.rb:293:in measure' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in
perform_action' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in
process_without_filters’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in
process_without_session_management_support' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in
process’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in
dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:150:in
process_request’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:54:in
process!' /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:600:in
each_cgi’
/usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:in each_cgi' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:53:in
process!’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:23:in
`process!’
/Users/nightdog/insert/public/dispatch.fcgi:24
Rendering
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/templates/rescues/layout.rhtml
(500 Internal Error)
Any ideas on what could be wrong? I tried a Recipe.search on the console
but it gives me the same error.
My database has a ‘recipes’ table with an id and a name string.
Thanks in advance,
Ricardo