visible true for all photos after create

This commit is contained in:
Alexander Negoda 2012-07-30 23:56:01 +04:00
parent c526882f27
commit b05879afdc

View file

@ -11,7 +11,7 @@ class Photo < ActiveRecord::Base
before_create :exif_read before_create :exif_read
before_update :exif_write before_update :exif_write
after_create :set_title after_create :set_title, :set_visible
attr_accessor :tag_list attr_accessor :tag_list
@ -59,9 +59,12 @@ class Photo < ActiveRecord::Base
private private
def set_visible
update_attribute(:public, true) unless self.public
end
def set_title def set_title
update_attribute(:title, self.attachment.file.basename.titleize) update_attribute(:title, self.attachment.file.basename.titleize) unless self.title
self.title = self.attachment.file.basename.titleize unless self.title
end end
def exif_read def exif_read