Fix sitemap nil

Fix namespace of role in subrole
This commit is contained in:
chris 2013-02-06 12:12:23 +08:00
parent f36bcb8801
commit 17ac564fbb
3 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
class Admin::SubRolesController < RolesController class Admin::SubRolesController < Admin::RolesController
end end

View File

@ -12,7 +12,7 @@ class Item
field :enabled_for, :type => Array, :default => nil field :enabled_for, :type => Array, :default => nil
field :menu_enabled_for, :type => Array, :default => nil field :menu_enabled_for, :type => Array, :default => nil
field :title, localize: true field :title, localize: true
field :sitemap_enabled, :type => Hash field :sitemap_enabled, :type => Hash, :default => {}
validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/ validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/
@ -57,7 +57,7 @@ class Item
end end
def show_in_sitemap_for(locale) def show_in_sitemap_for(locale)
if sitemap_enabled && !sitemap_enabled[locale].blank? if !sitemap_enabled.blank? && !sitemap_enabled[locale].blank?
sitemap_enabled[locale].eql?('true') ? true : false sitemap_enabled[locale].eql?('true') ? true : false
else else
true true

View File

@ -307,7 +307,7 @@ namespace :migrate do
task :sitemap_i18n => :environment do task :sitemap_i18n => :environment do
Item.all.each do |item| Item.all.each do |item|
item.sitemap_enabled = item.sitemap_enabled ? {'en' => 'true', 'zh_tw' => 'true'} : nil item.sitemap_enabled = item.sitemap_enabled ? {'en' => 'true', 'zh_tw' => 'true'} : {}
item.save item.save
end end
end end