Skip to content

Instantly share code, notes, and snippets.

@rubysolo
Created April 28, 2009 16:53
Show Gist options
  • Save rubysolo/103261 to your computer and use it in GitHub Desktop.
Save rubysolo/103261 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
var products = [<%=
@products.map do |product|
bids_json = product.bids.map(&:amount).join(',')
"{id: #{product.id}, name:'#{product.name}', bids:[#{bids_json}]}"
end.join(',')
%>];
var bids = {<%=
@products.map do |product|
bids_json = product.bids.map(&:amount).join(',')
"'#{product.id}':[#{bids_json}]"
end.join(',')
%>};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment