Class: ComfortableMexicanSofa::Seeds::Page::Importer
- Defined in:
- lib/comfortable_mexican_sofa/seeds/page/importer.rb
Instance Attribute Summary collapse
-
#target_pages ⇒ Object
tracking target page linking.
Attributes inherited from Importer
#from, #path, #seed_ids, #site, #to
Instance Method Summary collapse
- #import! ⇒ Object
-
#initialize(from, to = from) ⇒ Importer
constructor
A new instance of Importer.
Constructor Details
#initialize(from, to = from) ⇒ Importer
Returns a new instance of Importer.
10 11 12 13 |
# File 'lib/comfortable_mexican_sofa/seeds/page/importer.rb', line 10 def initialize(from, to = from) super self.path = ::File.join(ComfortableMexicanSofa.config.seeds_path, from, "pages/") end |
Instance Attribute Details
#target_pages ⇒ Object
tracking target page linking. Since we might be linking to something that doesn’t exist yet, we’ll defer linking to the end of import
8 9 10 |
# File 'lib/comfortable_mexican_sofa/seeds/page/importer.rb', line 8 def target_pages @target_pages end |
Instance Method Details
#import! ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/comfortable_mexican_sofa/seeds/page/importer.rb', line 15 def import! import_page(File.join(path, "index/"), nil) link_target_pages # Remove pages not found in seeds site.pages.where("id NOT IN (?)", seed_ids).destroy_all end |