visible true for all photos after create

master
Alexander Negoda 2012-07-30 23:56:01 +04:00
parent c526882f27
commit b05879afdc
1 changed files with 6 additions and 3 deletions

View File

@ -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