Sha256: 87b4f0800c38f5dba40e069dd35210f8520f83d32a582d8b64c3607699416728

Contents?: true

Size: 898 Bytes

Versions: 5

Compression:

Stored size: 898 Bytes

Contents

module AlchemyCrm
  class Seeder

    def self.seed!
      puts "Seeding database for Alchemy Mailing Module"
      root = Alchemy::Page.root
      lang = Alchemy::Language.get_default
      if root.nil? || lang.nil?
        puts "== Aborting! Not all dependencies found. Did you ran the Alchemy seeder?"
      else
        mailing_root = Alchemy::Page.find_or_create_by_name(
          :name => "Alchemy CRM Rootpage",
          :page_layout => 'alchemy_crm_rootpage',
          :do_not_autogenerate => true,
          :do_not_sweep => true,
          :language => lang,
          :parent_id => root.id
        )
        if mailing_root.new_record?
          mailing_root.save!
          mailing_root.move_to_child_of root
          puts "== Success! Mailing root page created"
        else
          puts "== Skipping! Already created mailing root page."
        end
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alchemy_crm-2.0.5 lib/alchemy_crm/seeder.rb
alchemy_crm-2.0.4.1 lib/alchemy_crm/seeder.rb
alchemy_crm-2.1.0a lib/alchemy_crm/seeder.rb
alchemy_crm-2.0.3 lib/alchemy_crm/seeder.rb
alchemy_crm-2.0.2 lib/alchemy_crm/seeder.rb