Fix the target page export/import to use the full_path instead of the id a la layouts and parent pages. #fix

Ryan Garver committed Mar 18, 2011
commit a9f415c01b80b727d169bd12e39527b3e5511422
Showing 2 changed files with 3 additions and 1 deletions
app/models/cms_page.rb +1 -0
@@ @@ -63,6 +63,7 @@ class CmsPage < ActiveRecord::Base
attributes[:cms_layout] = CmsLayout.load_from_file(site, attributes[:cms_layout])
attributes[:parent] = CmsPage.load_from_file(site, attributes[:parent])
attributes[:cms_site] = site
+ attributes[:target_page]= CmsPage.load_from_file(site, attributes[:target_page])
new(attributes)
rescue
raise "Failed to load from #{file_path}"
tasks/comfortable_mexican_sofa.rake b/lib/tasks/comfortable_mexican_sofa.rake +2 -1
@@ @@ -238,7 +238,8 @@ namespace :comfortable_mexican_sofa do
end
if should_write
- attributes = page.attributes.slice('label', 'slug', 'full_path', 'is_published', 'target_page_id')
+ attributes = page.attributes.slice('label', 'slug', 'full_path', 'is_published')
+ attributes['targe_page'] = page.target_page.full_path if page.target_page
attributes['parent'] = page.parent.full_path if page.parent
attributes['cms_layout'] = page.cms_layout.slug
attributes['cms_blocks_attributes'] = page.cms_blocks_attributes.collect{|b| b.delete(:id) && b.stringify_keys}