Rescue nil in Albums
This commit is contained in:
parent
1a4c689ee6
commit
f509e74938
|
@ -21,7 +21,7 @@ class Admin::SitesController < OrbitBackendController
|
|||
end
|
||||
|
||||
def update
|
||||
params[:site][:defalut_locale] = "zh_tw" if params[:site][:default_locale].blank?
|
||||
params[:site][:defalut_locale] = nil if params[:site][:default_locale].blank?
|
||||
@site.update_attributes(params[:site])
|
||||
redirect_to :back
|
||||
end
|
||||
|
|
|
@ -162,8 +162,9 @@ class ApplicationController < ActionController::Base
|
|||
#check enable langauge detection
|
||||
browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil
|
||||
condition = @site.in_use_locales.include?(browser_locale)
|
||||
elsif (@site.default_locale.nil? && @site.enable_language_detection.eql?(false))
|
||||
condition = @site.valid_locales.first
|
||||
elsif (@site.default_locale.nil? && @site.enable_language_detection.eql?(false) && session[:locale].nil?)
|
||||
session[:locale] = @site.valid_locales.first
|
||||
condition = @site.in_use_locales.include?(session[:locale])
|
||||
end
|
||||
|
||||
session[:locale] = condition ? (browser_locale || session[:locale] || default_locale || backup_locale) : I18n.default_locale.to_s
|
||||
|
|
|
@ -215,7 +215,7 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
|||
# tagsToAdd will contain all tag ids which ve to be added in tall album_images
|
||||
@images = AlbumImage.all
|
||||
@images.each do |image|
|
||||
image.tagged_ids.concat(tagsToAdd)
|
||||
image.tagged_ids.concat(tagsToAdd) if !tagsToAdd.blank?
|
||||
tagsToDestroy.each do |tag|
|
||||
if image.tagged_ids.include?tag
|
||||
image.tagged_ids.delete(tag)
|
||||
|
|
Reference in New Issue