Sha256: 23e4273c2862954a9226cccdd76b2372e34299ae8a66dcb5c8f2a7ba47e01011

Contents?: true

Size: 1.28 KB

Versions: 15

Compression:

Stored size: 1.28 KB

Contents

module Lolita
  module Translation

    module ORM

      module ClassMethods
        def translate *args, &block
          @translations_configuration ||= Lolita::Translation::Configuration.new(self,*args,&block)
        end

        def translations_configuration
          unless @translations_configuration
            raise Lolita::Translation::ConfigurationNotInitializedError.new(self)
          else
            @translations_configuration
          end
        end

        def sync_translation_table!
          migrator = Lolita::Translation::Migrator.create(self)
          migrator.migrate
        end

      end

      module InstanceMethods

        def translations_configuration
          self.class.translations_configuration
        end

        def translation_record
          @translation_record ||= Lolita::Translation::Record.new(self, translations_configuration)
        end

        def original_locale
          translation_record.default_locale
        end

        def original_locale=(value)
          translation_record.default_locale = value
        end

        def build_nested_translations
          translation_record.build_nested_translations
        end

        def in(locale,&block)
          translation_record.in(locale,&block) 
        end

      end

    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
lolita-translation-0.8.4 lib/lolita-translation/orm/mixin.rb
lolita-translation-0.8.3 lib/lolita-translation/orm/mixin.rb
lolita-translation-0.8.2 lib/lolita-translation/orm/mixin.rb
lolita-translation-0.8.1 lib/lolita-translation/orm/mixin.rb
lolita-translation-0.8.0 lib/lolita-translation/orm/mixin.rb
lolita-translation-0.7.4 lib/lolita-translation/orm/mixin.rb
lolita-translation-0.7.3 lib/lolita-translation/orm/mixin.rb
lolita-translation-0.7.2 lib/lolita-translation/orm/mixin.rb
lolita-translation-0.7.1 lib/lolita-translation/orm/mixin.rb
lolita-translation-0.7.0 lib/lolita-translation/orm/mixin.rb
lolita-translation-0.6.3 lib/lolita-translation/orm/mixin.rb
lolita-translation-0.6.2 lib/lolita-translation/orm/mixin.rb
lolita-translation-0.6.1 lib/lolita-translation/orm/mixin.rb
lolita-translation-0.6.0 lib/lolita-translation/orm/mixin.rb
lolita-translation-0.5.0 lib/lolita-translation/orm/mixin.rb