Skip to content

Instantly share code, notes, and snippets.

@jackcallister
Created August 9, 2013 01:18
Show Gist options
  • Save jackcallister/6190389 to your computer and use it in GitHub Desktop.
Save jackcallister/6190389 to your computer and use it in GitHub Desktop.
Model method delegation
# Delegate in a block to set up multiple delegations
with_options allow_nil: true do |product_delegate|
product_delegate.delegate :fields, to: :product_type
end
# Delegate as a method call
delegate :fields, to: :product_type, allow_nil: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment