lib/surveyor_gui/models/survey_methods.rb
def no_responses
        if self.id
          #this will be a problem if two people are editing the survey at the same time and do a survey preview - highly unlikely though.
          self.response_sets.where('test_data = ?',true).each {|r| r.destroy}
        end
        if !template && response_sets.count>0
          errors.add(:base,
                     I18n.t('surveyor_gui.surveys.no_responses.already_has_responses') + ' ' +  I18n.t('surveyor_gui.surveys.no_responses.create_new_survey_instead') )

          return false
        end
      end
#don't let a survey be deleted or changed if responses have been submitted
#to ensure data integrity
don't let a survey be deleted or changed if responses have been submitted
to ensure data integrity
don ' t let a survey be deleted or changed if responses have been submitted to ensure data integrity
def no_responses
        if self.id
          self.response_sets.where('test_data = ?',true).each {|r| r.destroy}
        end
        if !template && response_sets.count>0
          errors.add(:base,
                     I18n.t('surveyor_gui.surveys.no_responses.already_has_responses') + ' ' +  I18n.t('surveyor_gui.surveys.no_responses.create_new_survey_instead') )
          return false
        end
      end
def no_responses if self . id self . response_sets . where ( 'test_data = ?' , true ) . each { | r | r . destroy } end if ! template && response_sets . count > 0 errors . add ( :base , I18n . t ( 'surveyor_gui.surveys.no_responses.already_has_responses' ) + ' ' + I18n . t ( 'surveyor_gui.surveys.no_responses.create_new_survey_instead' ) ) return false end end
don't let a survey be deleted or changed if responses have been submitted
to ensure data integrity
don ' t let a survey be deleted or changed if responses have been submitted to ensure data integrity
#this will be a problem if two people are editing the survey at the same time and do a survey preview - highly unlikely though.