Last active
August 29, 2015 14:25
-
-
Save Sillson/c221c80b3ec37a2dbde7 to your computer and use it in GitHub Desktop.
Clean orion navigation nastiness after a clone
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :clean do | |
task :snags => :environment do | |
Location.all.each do |loc| | |
@pages = loc.website.web_page_templates | |
@pages.each do |i| | |
i.update_attribute(:parent_id, nil) if i.parent_id? | |
end | |
nav_id = (GardenWidget.find_by name: "Navigation").id | |
@nav_setting = (loc.website.widgets.find_by garden_widget_id: nav_id).navigation.object | |
updated_value = @nav_setting.value.each {|k,v| v.update(:child_templates => {})} | |
@nav_setting.update_attributes(:value => updated_value) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment