Skip to content

Instantly share code, notes, and snippets.

@ionas
Created December 27, 2010 18:49
Show Gist options
  • Save ionas/756409 to your computer and use it in GitHub Desktop.
Save ionas/756409 to your computer and use it in GitHub Desktop.
Call via Product.labels(:price)
# TODO: do label translation here as well.
@@labels = {
:price => 'Price incl. VAT'
}
def self.labels(attribute_name)
if @@labels[attribute_name]
@@labels[attribute_name]
else
attribute_name.to_s.titleize
end
end
@ionas
Copy link
Author

ionas commented Dec 27, 2010

Use like <%= Product.labels :price %>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment