lib/lit/cache.rb
# this comes directly from copycopter.
this comes directly from copycopter.
this comes directly from copycopter .
def export
      reset
      localizations_scope = Lit::Localization
      unless ENV['LOCALES'].blank?
        locale_keys = ENV['LOCALES'].to_s.split(',') || []
        locale_ids = Lit::Locale.where(locale: locale_keys).pluck(:id)
        localizations_scope = localizations_scope.where(locale_id: locale_ids) unless locale_ids.empty?
      end
      db_localizations = {}
      localizations_scope.find_each do |l|
        db_localizations[l.full_key] = l.get_value
      end
      keys = nested_string_keys_to_hash(db_localizations)
      keys.to_yaml
    end
def export reset localizations_scope = Lit :: Localization unless ENV [ 'LOCALES' ] . blank? locale_keys = ENV [ 'LOCALES' ] . to_s . split ( ',' ) || [ ] locale_ids = Lit :: Locale . where ( locale : locale_keys ) . pluck ( :id ) localizations_scope = localizations_scope . where ( locale_id : locale_ids ) unless locale_ids . empty? end db_localizations = { } localizations_scope . find_each do | l | db_localizations [ l . full_key ] = l . get_value end keys = nested_string_keys_to_hash ( db_localizations ) keys . to_yaml end
this comes directly from copycopter.
this comes directly from copycopter .