fix error
This commit is contained in:
parent
6a877c8e2d
commit
ebdd9b6db4
|
@ -49,7 +49,7 @@ class GalleriesController < ApplicationController
|
|||
thumb_src = a.cover_path(@image_version)
|
||||
if thumb_src
|
||||
thumb_srcs = thumb_src.split('/')
|
||||
thumb_srcs[-1] = thumb_srcs[-1].sub(/^\w+_/,"")
|
||||
thumb_srcs[-1] = thumb_srcs[-1].sub(/^(?:(?!_).)*_/,"")
|
||||
thumb_path = thumb_srcs[0..-2].join('/')
|
||||
thumb_path_name = thumb_srcs[-1]
|
||||
src = "#{thumb_path}/#{thumb_path_name}"
|
||||
|
|
|
@ -37,6 +37,14 @@ class AlbumImage
|
|||
Album.where(:id=>self.album_id).update_all(:min_order=>min_order + 1)
|
||||
end
|
||||
end
|
||||
before_save do
|
||||
if self.file_changed?
|
||||
cover = self.album['cover']
|
||||
if cover && cover == self.id
|
||||
self.album.update_attributes({:cover_path => self.file.thumb.url, :cover=> self.id})
|
||||
end
|
||||
end
|
||||
end
|
||||
def title_translations
|
||||
tmp = super || {}
|
||||
if tmp == {}
|
||||
|
|
Loading…
Reference in New Issue