protected
This commit is contained in:
parent
e95b6e6978
commit
2ddea72d7f
2 changed files with 6 additions and 3 deletions
|
@ -92,7 +92,7 @@ class Album < ActiveRecord::Base
|
||||||
|
|
||||||
def create_folders
|
def create_folders
|
||||||
Dir.mkdir( APP_CONFIG[:photos_path] + self.path ) unless File.exists?( APP_CONFIG[:photos_path] + self.path )
|
Dir.mkdir( APP_CONFIG[:photos_path] + self.path ) unless File.exists?( APP_CONFIG[:photos_path] + self.path )
|
||||||
Dir.mkdir( APP_CONFIG[:thumbs_path] + self.path.encode("ASCII-8BIT") ) unless File.exists?( APP_CONFIG[:thumbs_path] + self.path )
|
Dir.mkdir( APP_CONFIG[:thumbs_path] + self.path ) unless File.exists?( APP_CONFIG[:thumbs_path] + self.path )
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy_folders
|
def destroy_folders
|
||||||
|
|
|
@ -18,7 +18,8 @@ module ScanFiles
|
||||||
end
|
end
|
||||||
if album.nil?
|
if album.nil?
|
||||||
puts "New album : " + File.basename( relpath )
|
puts "New album : " + File.basename( relpath )
|
||||||
album = Album.new( :path => relpath )
|
album = Album.new()
|
||||||
|
album.path = relpath
|
||||||
unless album.save
|
unless album.save
|
||||||
raise "unable to save album"
|
raise "unable to save album"
|
||||||
end
|
end
|
||||||
|
@ -26,7 +27,9 @@ module ScanFiles
|
||||||
photo = Photo.find_by_path( relfile )
|
photo = Photo.find_by_path( relfile )
|
||||||
if photo.nil?
|
if photo.nil?
|
||||||
puts " New photo added " + relfile
|
puts " New photo added " + relfile
|
||||||
photo = Photo.new( :album => album, :path => relfile )
|
photo = Photo.new( )
|
||||||
|
photo.album = album
|
||||||
|
photo.path = relfile
|
||||||
unless photo.save
|
unless photo.save
|
||||||
raise "unable to save photo"
|
raise "unable to save photo"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue