Sha256: 93e5f95eff7f29aceb558df4a4252c00312dd76bd271987d221e3f510b167127

Contents?: true

Size: 919 Bytes

Versions: 1

Compression:

Stored size: 919 Bytes

Contents

Dir[File.join(File.dirname(__FILE__), 'has_many_translations', '*.rb')].each{|f| require f }

require 'to_lang'
require 'activequeue'

# The base module that gets included in ActiveRecord::Base. See the documentation for
# HasManyTranslations::ClassMethods for more useful information.
module HasManyTranslations
  
  
  def self.included(base) # :nodoc:
    base.class_eval do
      extend ClassMethods
      extend Translated
    end
  end
  
  module ClassMethods
    def translated(options = {}, &block)
      return if translated?
      
      include Options
      include TranslationJobs
      include Creation
      include Control
      include Translations
      prepare_translated_options(options)
      has_many :translations, options.merge({:order => "translations.updated_at DESC"}), &block
      
    end
    
  end
  
  extend Configuration
  
end

ActiveRecord::Base.send(:include, HasManyTranslations)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
has_many_translations-0.4.6 lib/has_many_translations.rb