Skip to content

Instantly share code, notes, and snippets.

@dumbledore
Created October 20, 2010 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dumbledore/636705 to your computer and use it in GitHub Desktop.
Save dumbledore/636705 to your computer and use it in GitHub Desktop.
Example for using html_safe in Rails 3
<%= stylesheet_link_tag 'suggest.min' %>
<%= javascript_include_tag 'jquery.min' %>
<%= javascript_include_tag 'suggest.min' %>
<script type="text/javascript">
$(function() {
$("#<%= @search_field %>")
.suggest({
"type": "<%= @type_info %>"
<%= ", \"mql_filter\": [{#{h(@mql_filter)}}]".html_safe unless @mql_filter.nil? %>
})
.bind("fb-select", function(e, data) {
document.getElementById('<%= @freebase_field %>').value = data.id;
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment