RS, IZ; Albums must be pushed
This commit is contained in:
parent
a4b0d47edc
commit
a6104fd2b5
1 changed files with 4 additions and 2 deletions
|
|
@ -3,7 +3,6 @@ class Album
|
||||||
include MongoMapper::Document
|
include MongoMapper::Document
|
||||||
include ROXML
|
include ROXML
|
||||||
include Diaspora::Webhooks
|
include Diaspora::Webhooks
|
||||||
include Encryptable
|
|
||||||
|
|
||||||
xml_reader :name
|
xml_reader :name
|
||||||
xml_reader :person, :as => Person
|
xml_reader :person, :as => Person
|
||||||
|
|
@ -19,6 +18,7 @@ class Album
|
||||||
|
|
||||||
before_destroy :destroy_photos
|
before_destroy :destroy_photos
|
||||||
|
|
||||||
|
after_save :send_to_view
|
||||||
def prev_photo(photo)
|
def prev_photo(photo)
|
||||||
n_photo = self.photos.where(:created_at.lt => photo.created_at).sort(:created_at.desc).first
|
n_photo = self.photos.where(:created_at.lt => photo.created_at).sort(:created_at.desc).first
|
||||||
n_photo ? n_photo : self.photos.sort(:created_at.desc).first
|
n_photo ? n_photo : self.photos.sort(:created_at.desc).first
|
||||||
|
|
@ -34,5 +34,7 @@ class Album
|
||||||
def destroy_photos
|
def destroy_photos
|
||||||
photos.each{|p| p.destroy}
|
photos.each{|p| p.destroy}
|
||||||
end
|
end
|
||||||
|
def send_to_view
|
||||||
|
SocketsController.new.outgoing(self)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue