Module: Globalize2::LocalizedContent

Defined in:
lib/globalize2/localized_content.rb

Instance Method Summary collapse

Instance Method Details

#localized_content_for(*fields) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/globalize2/localized_content.rb', line 2

def localized_content_for *fields
  fields.each do |field|
    class_eval %{
      def #{field}_with_localized_content
        I18n.with_locale(Globalize2Extension.content_locale) do
          #{field}_without_localized_content
        end
      end
    }

    alias_method_chain field, :localized_content
  end
end