Autocomplete text field with HABTM association - PLEASE HELP

can anyone help me work this functionality out? I actually have 3
classes each with a HABTM relationships with each other but right now
I am just trying to get one to work. I have 2 models, ‘employees’ and
‘practices’ (healthcare field), and would like to have a text field on
the ‘employees’ new and edit views so the practice(s) this employee
belongs to can be added.

I have the linking table employees_practices created successfully and
the HABTM associations created in the models (to each other).
I have installed the plugin: script/plugin install

  • as it is no longer included in rails 2.3.8.
    I have included the <%= javascript_include_tag :defaults %> in the
    application.html.erb ((so its available throughout the app))
    I have included <%= text_field_with_auto_complete :practice, :name
    %> in my _form for ‘employees’
    I have added auto_complete_for :practice, :name to my employee

i normally get some variety of ‘method undefined…etc’ or some other
variation no matter what i do.
couple things: I did not create a new search controller as I am
trying to add this text field to the existing views for ‘employee’
generated when I used nifty_scaffold to create employee. Also I feel
like at least some of my issue is definitely in the controller, I
don’t think just adding auto_complete_for :practice, :name to the
controller should work. I have tried all sorts of methods and can’t
get it to work.
I would like to actually be able to list multiple ‘practices’ in the
field separated by commas (something about using a token?

can anyone walk me through this? help with the controller? everything
else look right?


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