Skip to content

Instantly share code, notes, and snippets.

@Sillson
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sillson/c221c80b3ec37a2dbde7 to your computer and use it in GitHub Desktop.
Save Sillson/c221c80b3ec37a2dbde7 to your computer and use it in GitHub Desktop.
Clean orion navigation nastiness after a clone
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