FEATURE: make show_subcategory_list a per-category setting

This commit is contained in:
Neil Lalonde
2017-02-21 18:08:09 -05:00
parent 2f657b0e32
commit a702330ccd
40 changed files with 39 additions and 43 deletions

View File

@ -0,0 +1,14 @@
class AddShowSubcategoryListToCategories < ActiveRecord::Migration
def up
add_column :categories, :show_subcategory_list, :boolean, default: false
result = execute("select count(1) from site_settings where name = 'show_subcategory_list' and value = 't'")
if result[0] and result[0]["count"].to_i > 0
execute "UPDATE categories SET show_subcategory_list = true WHERE parent_category_id IS NULL"
end
end
def down
remove_column :categories, :show_subcategory_list
end
end