move some delete and destroy to base
This commit is contained in:
parent
fc611ce5c4
commit
034d605d78
@ -33,13 +33,8 @@ module Merged
|
||||
CardStyle.find_by_template( self.template )
|
||||
end
|
||||
|
||||
def destroy
|
||||
delete
|
||||
Card.save_all
|
||||
end
|
||||
|
||||
def delete(reindex = true)
|
||||
Card.delete( self.id )
|
||||
super()
|
||||
section.reset_index if reindex
|
||||
end
|
||||
|
||||
|
@ -43,13 +43,8 @@ module Merged
|
||||
end
|
||||
|
||||
def destroy
|
||||
delete
|
||||
File.delete self.full_filename
|
||||
Image.save_all
|
||||
end
|
||||
|
||||
def delete
|
||||
Image.delete( self.id )
|
||||
super
|
||||
end
|
||||
|
||||
def asset_name
|
||||
|
@ -56,7 +56,7 @@ module Merged
|
||||
has_sections = sections.length
|
||||
has_cards = 0
|
||||
sections.each {|section| has_cards += section.delete(false) }
|
||||
Page.delete( self.id )
|
||||
super
|
||||
[has_sections , has_cards]
|
||||
end
|
||||
|
||||
|
@ -8,6 +8,15 @@ module ActiveYaml
|
||||
self.class.save_all
|
||||
end
|
||||
|
||||
def delete
|
||||
self.class.delete(self.id)
|
||||
end
|
||||
|
||||
def destroy
|
||||
delete
|
||||
self.class.save_all
|
||||
end
|
||||
|
||||
def self.save_all
|
||||
data = @records.collect {|obj| obj.attributes}
|
||||
File.write( self.full_path , data.to_yaml)
|
||||
@ -20,8 +29,5 @@ module ActiveYaml
|
||||
true
|
||||
end
|
||||
|
||||
def self.the_private_records
|
||||
@records
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user