Forum: Ruby on Rails referencing a table

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Craig W. (Guest)
on 2006-01-28 07:35
(Received via mailing list)
I am trying to use auto_complete_for to reference a different table.

in my clients_controller.rb file

  auto_complete_for :case_manager :case_manager.name
                                   ^^^^^^^^^^^^
                                this is not the clients table

my models/clients.rb has:
  has_one: case_manager

The above 'auto_complete_for' line in clients_controller.rb generates
the following error when I attempt to access clients/index.html

How can I make this work?

SyntaxError in <controller not set>#<action not set>
./script/../config/../app/controllers/clients_controller.rb:3: syntax
error
  auto_complete_for :case_manager :case_manager.name
                                   ^

RAILS_ROOT: script/../config/..

Application Trace | Framework Trace | Full Trace
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:207:in
`load'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:207:in
`load'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:39:in
`require_or_load'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:22:in
`depend_on'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:178:in
`require_dependency'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:134:in
`load_file!'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:97:in
`const_load!'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:80:in
`const_load!'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:72:in
`const_missing'
routing.rb:234:in `traverse_to_controller'
generated/routing/recognition.rb:3:in `eval'
generated/routing/recognition.rb:3:in `recognize_path'
joey__ (Guest)
on 2006-01-28 10:13
>   auto_complete_for :case_manager :case_manager.name

I believe it should be:
auto_complete_for :case_manager, :name

Joey
This topic is locked and can not be replied to.