-
-
Save gedankenstuecke/1209653 to your computer and use it in GitHub Desktop.
Initializing a jQuery UI autocomplete with data from a Rails array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
// Trying to help @gedankenstuecke here. A bit hard because I don’t speak Rails (neither Ruby) and can’t try live what the output looks like. | |
$(function () { | |
$("#<%=p.object.phenotype_id.to_json%>").autocomplete({ | |
source: <%=raw(Phenotype.find_by_id(p.object.phenotype_id).known_phenotypes.to_json)%> | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just needed to be fed to raw() to produce conform code