protected
This commit is contained in:
parent
e95b6e6978
commit
2ddea72d7f
|
@ -92,7 +92,7 @@ class Album < ActiveRecord::Base
|
|||
|
||||
def create_folders
|
||||
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
|
||||
|
||||
def destroy_folders
|
||||
|
|
|
@ -18,7 +18,8 @@ module ScanFiles
|
|||
end
|
||||
if album.nil?
|
||||
puts "New album : " + File.basename( relpath )
|
||||
album = Album.new( :path => relpath )
|
||||
album = Album.new()
|
||||
album.path = relpath
|
||||
unless album.save
|
||||
raise "unable to save album"
|
||||
end
|
||||
|
@ -26,7 +27,9 @@ module ScanFiles
|
|||
photo = Photo.find_by_path( relfile )
|
||||
if photo.nil?
|
||||
puts " New photo added " + relfile
|
||||
photo = Photo.new( :album => album, :path => relfile )
|
||||
photo = Photo.new( )
|
||||
photo.album = album
|
||||
photo.path = relfile
|
||||
unless photo.save
|
||||
raise "unable to save photo"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue