fix bug
This commit is contained in:
		
							parent
							
								
									c7610faff4
								
							
						
					
					
						commit
						8e53925406
					
				|  | @ -11,8 +11,10 @@ class FaqsController < ApplicationController | |||
|       end | ||||
|       qa_files = qa.qa_files.map do |qa_file| | ||||
|         next if !qa_file.enabled_for?(locale) | ||||
|         file = qa_file.file | ||||
|         next if file.path.nil? | ||||
|         { | ||||
|           "file_url" => qa_file.file.url + "\" title=\"#{qa_file.file_title}", | ||||
|           "file_url" => file.url + "\" title=\"#{qa_file.file_title}", | ||||
|           "file_title" => (qa_file.title.blank? ? File.basename(qa_file["file"]) : qa_file.title) | ||||
|         } | ||||
|       end.compact | ||||
|  | @ -42,8 +44,10 @@ class FaqsController < ApplicationController | |||
| 
 | ||||
|     faqs_files = faq.qa_files.collect do |f| | ||||
|       next if !qa_file.enabled_for?(locale) | ||||
|       file = qa_file.file | ||||
|       next if file.path.nil? | ||||
|       { | ||||
|         "file_url" => f.file.url + "\" title=\"#{f.file_title}", | ||||
|         "file_url" => file.url + "\" title=\"#{f.file_title}", | ||||
|         "file_title" => f.title | ||||
|       } | ||||
|     end.compact | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ class QaFile | |||
|     elsif self.title.present? | ||||
|       return self.title | ||||
|     else | ||||
|       return File.basename(self.file.path) | ||||
|       return (File.basename(self.file.path) rescue nil) | ||||
|     end | ||||
|   end | ||||
|   def enabled_for?(lang) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue