Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # HasForeignLanguage
- module HasForeignLanguage
- def self.included(mod)
- mod.extend(ClassMethods)
- end
- module ClassMethods
- def has_foreign_language(*args)
- args.each do |field|
- define_method(field.to_s) do
- if I18n.locale != I18n.default_locale
- self.send("#{field}_#{I18n.locale}".to_s)
- else
- super
- end
- end
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment