From b05879afdc507c2e1253b26f17e5a7bd4fa18f5d Mon Sep 17 00:00:00 2001 From: Alexander Negoda Date: Mon, 30 Jul 2012 23:56:01 +0400 Subject: [PATCH] visible true for all photos after create --- app/models/photo.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/models/photo.rb b/app/models/photo.rb index c9ceff7..db096f2 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -11,7 +11,7 @@ class Photo < ActiveRecord::Base before_create :exif_read before_update :exif_write - after_create :set_title + after_create :set_title, :set_visible attr_accessor :tag_list @@ -59,9 +59,12 @@ class Photo < ActiveRecord::Base private + def set_visible + update_attribute(:public, true) unless self.public + end + def set_title - update_attribute(:title, self.attachment.file.basename.titleize) - self.title = self.attachment.file.basename.titleize unless self.title + update_attribute(:title, self.attachment.file.basename.titleize) unless self.title end def exif_read