app/models/questionnaire.rb
def build_questionnaire_fields!
    languages = ['ar', 'zh', 'en', 'es', 'fr', 'ru'] - self.questionnaire_fields.map{ |a| a.language }#&:language
    languages.each do |lang|
      self.questionnaire_fields.build(:language => lang)
    end
    self.questionnaire_fields.sort!{ |a,b| a.language <=> b.language }
  end
#build questionnaire_field objects for the languages missing from the 6 existing languages
build questionnaire_field objects for the languages missing from the 6 existing languages
build questionnaire_field objects for the languages missing from the 6 existing languages
def build_questionnaire_fields!
    languages = ['ar', 'zh', 'en', 'es', 'fr', 'ru'] - self.questionnaire_fields.map{ |a| a.language }
    languages.each do |lang|
      self.questionnaire_fields.build(:language => lang)
    end
    self.questionnaire_fields.sort!{ |a,b| a.language <=> b.language }
  end
def build_questionnaire_fields! languages = [ 'ar' , 'zh' , 'en' , 'es' , 'fr' , 'ru' ] - self . questionnaire_fields . map { | a | a . language } languages . each do | lang | self . questionnaire_fields . build ( :language => lang ) end self . questionnaire_fields . sort! { | a , b | a . language <=> b . language } end
build questionnaire_field objects for the languages missing from the 6 existing languages
build questionnaire_field objects for the languages missing from the 6 existing languages
#&:language