Skip to content

Instantly share code, notes, and snippets.

@Sailias
Created July 5, 2012 16:38
Show Gist options
  • Select an option

  • Save Sailias/3054711 to your computer and use it in GitHub Desktop.

Select an option

Save Sailias/3054711 to your computer and use it in GitHub Desktop.
<%= select_tag :other_select, options_for_select(@collection) %>
def get_contents_for_other_select
@collection = Model.where(..).collect{|c| [c.name, c.id]}
render 'other_select'
end
$('#first_select').live click, (e) ->
$.ajax({
url: 'get_contents_for_other_select'
success: (response, data) ->
$('#other_select_holder').html(data)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment