Module: Gluttonberg::Content::Localization

Defined in:
lib/gluttonberg/content/localization.rb

Overview

A mixin with allows for any arbitrary model to be localized. It will generate the localization models and add methods for creating and retrieving localized versions of a record.

Defined Under Namespace

Modules: Model, ModelLocalization

Class Method Summary (collapse)

Class Method Details

+ (Object) included(klass)

The included hook is used to create a bunch of class ivars we need to store various bits of configuration.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/gluttonberg/content/localization.rb', line 9

def self.included(klass)
  klass.class_eval do
    extend  Model::ClassMethods
    include Model::InstanceMethods
    
    class << self; 
      attr_reader :localized, :localized_model, :localized_fields, :locale;
    end
    @localized = false
    @localized_fields = []
    
    attr_reader :current_localization          
  end
end