db/migrate/20140223190922_add_new_transaction_type_share_for_free.rb
def create_translations_for(trans_type, community)

    community.locales.each do |locale|
      if TransactionTypeTranslation.find_by_transaction_type_id_and_locale(trans_type.id, locale)
        puts "WARNING: #{locale} translation for trans_type.id #{trans_type.id} already exists"

      else 

        translated_name = I18n.t(trans_type.api_name, :locale => locale, :scope => ["admin", "transaction_types"])

        TransactionTypeTranslation.create(:locale => locale, :transaction_type_id => trans_type.id, 
          :name => translated_name)
      end
    end

  end
# Creates translations for new transaciton type
Creates translations for new transaciton type
Creates translations for new transaciton type
def create_translations_for(trans_type, community)
    community.locales.each do |locale|
      if TransactionTypeTranslation.find_by_transaction_type_id_and_locale(trans_type.id, locale)
        puts "WARNING: #{locale} translation for trans_type.id #{trans_type.id} already exists"
      else 
        translated_name = I18n.t(trans_type.api_name, :locale => locale, :scope => ["admin", "transaction_types"])
        TransactionTypeTranslation.create(:locale => locale, :transaction_type_id => trans_type.id, 
          :name => translated_name)
      end
    end
  end
def create_translations_for ( trans_type , community ) community . locales . each do | locale | if TransactionTypeTranslation . find_by_transaction_type_id_and_locale ( trans_type . id , locale ) puts "WARNING: #{locale} translation for trans_type.id #{trans_type.id} already exists" else translated_name = I18n . t ( trans_type . api_name , :locale => locale , :scope => [ "admin" , "transaction_types" ] ) TransactionTypeTranslation . create ( :locale => locale , :transaction_type_id => trans_type . id , :name => translated_name ) end end end
Creates translations for new transaciton type
Creates translations for new transaciton type
trans_type
community