Skip to content

Instantly share code, notes, and snippets.

@tekin
Created March 18, 2009 22:41
Show Gist options
  • Save tekin/81456 to your computer and use it in GitHub Desktop.
Save tekin/81456 to your computer and use it in GitHub Desktop.
<%= options_from_collection_for_select(@product.sizes, :name, :id, :disabled => lambda{|size| size.out_of_stock?}) %>
<!-- If small and medium returned true for the method out_of_stock?, you’d get something like: -->
<option value=“23“ disabled=“disabled“>small</option>
<option value=“24“ disabled=“disabled“>medium</option>
<option value=“25“>large</option>
<option value=“26“>extra large</option>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment