# File app/models/smerf_form.rb, line 69 def rebuild_cache(code) # First clear the current cache self.cache = nil ; self.save if (!code.blank?) self.cache = Hash.new # Build the form and save to cache smerffile = SmerfFile.new(code) smerffile.validate() self.cache[:smerfform] = smerffile self.cache_date = File.mtime(smerffile.smerf_file_name).utc if (self.code.blank?()) # Set code self.code = code # Set as active self.active = 1 end # Assign the name as it may have changed self.name = self.cache[:smerfform].name # Save the changes self.save!() end