Skip to content

Instantly share code, notes, and snippets.

@hukl
Created April 30, 2009 08:29
Show Gist options
  • Save hukl/104345 to your computer and use it in GitHub Desktop.
Save hukl/104345 to your computer and use it in GitHub Desktop.
klass.send :define_method, "translated_#{attr_name}", lambda {|*loc|
loc = loc.first || I18n.locale
globalize.fetch loc, attr_name
}
klass.send :define_method, "set_translated_#{attr_name}", lambda {|loc, val|
globalize.stash loc, attr_name, val
self[attr_name] = val
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment