Skip to content

Instantly share code, notes, and snippets.

@jonpaul
Created September 28, 2011 05:02
Show Gist options
  • Save jonpaul/1247029 to your computer and use it in GitHub Desktop.
Save jonpaul/1247029 to your computer and use it in GitHub Desktop.
var staffs = new Array();
var staff_to_services = new Array();
var arr = new Array();
staffs.push( new Array(null, 'Choose a staff member', null) );
staffs.push( new Array(0, 'Any', 0) );
<!-- make the staffs select -->
<!-- @staff_members gets populated by this controller method -->
<% @staff_members.each do |staff| %>
<% staff.services.each do |service| %>
staffs.push(new Array('<%= service.id %>', '<%= staff.first %>', '<%= staff.id %>'))
arr.push('<%= service.id %>');
<% end %>
staff_to_services['<%= staff.id %>'] = arr;
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment