refactored search

This commit is contained in:
albert
2013-01-10 17:45:52 -05:00
parent 13271e9bf5
commit 8749c43b3e
85 changed files with 946 additions and 304 deletions

View File

@@ -29,7 +29,7 @@ class Advertisement < ActiveRecord::Base
end
def date_prefix
created_at.strftime("%Y%m%d")
created_at.try(:strftime, "%Y%m%d")
end
def image_path
@@ -43,6 +43,7 @@ class Advertisement < ActiveRecord::Base
def file=(f)
if f.size > 0
self.file_name = unique_identifier + File.extname(f.original_filename)
FileUtils.mkdir_p(File.dirname(image_path))
if f.local_path
FileUtils.cp(f.local_path, image_path)