Skip to content

Instantly share code, notes, and snippets.

@texel
Created September 1, 2009 23:25
Show Gist options
  • Save texel/179462 to your computer and use it in GitHub Desktop.
Save texel/179462 to your computer and use it in GitHub Desktop.
table_for @discount_codes do |table|
table.column :code
table.column :description
table.column :max_uses, :label => 'Maximum Uses' do |discount_code|
discount_code.max_uses || 'Unlimited'
end
end
# I want to be able to do this:
<%- table_for @discount_codes do |table| -%>
<%- table.column :code -%>
<%- table.column :description -%>
<%- table.column :max_uses, :label => 'Maximum Uses' do |discount_code| -%>
You have <%= discount_code.max_uses || 'Unlimited' %> discount codes!
<%- end -%>
<%- end -%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment