Agile Web Development

Build it. Launch it. Love it.


model_auto_completer provides autocompletion for models. That is, the user autocompletes a text field, but the widget is able to manage a hidden field that stores the ID of the model that corresponds to the selected completion.

Such a widget may be useful when the number of options is too much for a select. Say you need to assign a director to a movie having a database of hundreds of directors. With this plugin it is easy to let the user autocomplete by director name, and have a robust database ID managed under the hood.


Repository svn://
License Rails' (MIT)
Rating (46 votes)
Owner ASPgems
Created 18 January 2007


  • Avatar
    Wolfram Arnold
    11 February 2008

    This is a cool plugin. I'm missing a way to turn off the automatic suffix generation for the text field ID. This screws up the automatic insertion of a div tag for error highlighting if the field is wrong/missing (relevant only here, if :allowfreetext => true), of course.

  • Avatar
    12 February 2008

    @Wolfram: good, I'm working on a new release and will add this feature. Thank you!

  • Avatar
    31 March 2008

    If you want modelautocompleter not to generate inline CSS, just:

    <%= belongstoautocompleter :book, :author, :fullname, {}, {}, { :skipstyle => true } %>

  • Avatar
    31 March 2008

    @Javier Vidal, thank you, added to the docs of 1.5.

    @Wolfram, provided as a flag :appendrandomsuffix, in 1.5 as well.

  • Avatar
    5 May 2008

    Well done,Xavier,thanks a lot.

  • Avatar
    30 June 2008

    It would be cool if there were a way to use this with has_many :through

  • Avatar
    8 July 2008

    @jc would you please send me a use case at fxn at hashref dot com?

  • Avatar
    16 October 2008

    Thank you for this plug-in Xavier, you've saved me from having to re-invent the wheel! ;-)

  • Avatar
    6 April 2009

    Thanks for this very useful plugin. It just lack auto error displaying :-(

Add a comment