Auto_complete works sometimes

Hello All:

I have set up an auto_complete search field within my application
controller and application layout so that it is available to all pages
in my app. I have run into a snag with this in two projects I am working
on where it won’t work on one particular page related to a specific
controller.

I get a No Method error on the column name referenced in the
auto_complete arguments, even though the column name is set correctly
and the feature works on every other page in the app…not sure why. Any
ideas?

Thanks,
David

Figured it out straight away…the model referenced in the auto_complete
arguments was in the singular (client), but I had also created a
variable @client in the controller method for that page to call some
other data from the client table. This seemed to cause a conflict with
the auto_complete call. By changing @client to @clients in the
controller it worked.

Maybe this will help someone. Anybody know why exactly it caused the
error in the first place?

Cheers,
David

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs