Sha256: 3eabaaa97b8d6366f2220b679241b6fb6a22c97aebb4856dc7b354c3b7002abd

Contents?: true

Size: 517 Bytes

Versions: 10

Compression:

Stored size: 517 Bytes

Contents

module Globalize
  module ActiveRecord
    class Translation < ::ActiveRecord::Base
      class << self
        def with_locales(*locales)
          where(:locale => locales.flatten.map(&:to_s))
        end
        alias with_locale with_locales

        def translated_locales
          select('DISTINCT locale').map(&:locale)
        end
      end

      def locale
        read_attribute(:locale).to_sym
      end

      def locale=(locale)
        write_attribute(:locale, locale.to_s)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
globalize3-jovoto-0.1.0.beta lib/globalize/active_record/translation.rb
globalize3-0.1.0.beta lib/globalize/active_record/translation.rb
globalize3-0.0.11 lib/globalize/active_record/translation.rb
globalize3-0.0.10 lib/globalize/active_record/translation.rb
globalize3-0.0.9 lib/globalize/active_record/translation.rb
globalize3-0.0.7 lib/globalize/active_record/translation.rb
globalize3-0.0.5 lib/globalize/active_record/translation.rb
globalize3-0.0.4 lib/globalize/active_record/translation.rb
globalize3-0.0.3 lib/globalize/active_record/translation.rb
globalize3-0.0.2 lib/globalize/active_record/translation.rb