Updating Chosen field options
===

In Rails, I have a form on my Dish page that has a multi-select [Chosen][1] field called Side Dishes.

I'd like to have my Side Dishes Chosen field's options to automatically update (without page reload) if the user added another Side Dish from another browser window.

I looked into the *[Updating Chosen Dynamically][2]* from the Chosen website but I don't know if that's what I'm looking for and/or whether I'm understanding it correctly.

Currently, my `dishes.js.coffee` looks like this:

    jQuery ->
      $(".chzn-side-dish").chosen()
      $(".chzn-side-dish").trigger "liszt:updated"

But clearly that doesn't do the trick. My understanding was that the `.trigger` will periodically refresh the Side Dish list and pick up on any new additions (or deletions) from the Side Dish table.

And the form on the Dish page follows this convention:

    = form_for @dish, :html => { :class => "form-horizontal" } do |f|
    ...
    %fieldset
      .control-group
        =f.label :side_dish_ids, "Side Dish(es)", :class => 'control-label'
        .controls
          =f.collection_select :side_dish_ids, SideDish.order(:name), :id, :name, {}, {multiple: true, :class => 'chzn-side-dish'}

PS -- I've looked at [other SO][3] questions but couldn't get it all to work. Again, I'm not sure whether I'm understanding the purpose of the `.trigger...` properly.


  [1]: http://harvesthq.github.com/chosen/
  [2]: http://harvesthq.github.com/chosen/
  [3]: http://stackoverflow.com/questions/11352207/jquery-chosen-plugin-add-options-dynamically