Forum: Radiant CMS My own custimized db:bootstrap

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
0f23c9eeddf9cb0080723d8da2124c43?d=identicon&s=25 Jonathan Métillon (jmetillon)
on 2007-05-31 18:00
(Received via mailing list)

I have created a reference radiant website, where I get exactly what I
need for any other website I added YUI stylesheets, XML Sitemap,
contact form, etc...

Now I would like to "take a snapshot" of it and be able to apply it to
any new radiant website I create.

What would be the better way to do that?

I though of simply dumping the database, but then it would be broken
with future Radiant versions.

So I think the solution is in the migrations?

When doing rake db:bootstrap, you are presented with a choice of 3
websites templates: empty, blog and fully styled blog. How can I add
my own template here?


8802b1fa1b53e2197beea9454244f847?d=identicon&s=25 Sean Cribbs (Guest)
on 2007-05-31 18:06
(Received via mailing list)
Check out the bleeding-edge import_export extension.  In creating it, I
leveraged a lot of existing code in the db:bootstrap task, so it
essentially creates a template similar to the predefined ones.
*However*, it also loads users from the template, unlike the
pre-packaged ones.  The extension essentially works but may have
undiscovered bugs.  Caveat emptor.

Ff2c500b4f2690c6e60d580f6b3caf78?d=identicon&s=25 David Minor (Guest)
on 2007-05-31 18:31
(Received via mailing list)
I tried to use the import_export extension recently and ran into
errors on the import.  I was a bad boy and didn't report it though.
I figured it was just me.  I ended up just dumping the db and
importing into production.  I think it was during railsconf and the
list was slow, so I just didn't take the time.  sorry.

53403b4e20f4ec66df3085e54d625d49?d=identicon&s=25 Luca Erzegovesi (lerzegov)
on 2007-06-01 15:08
Jonathan Métillon wrote:
>I exported very easily to YAML using /admin/export
>And I created a new Radiant app with empty template, then:
>rake db:import TEMPLATE=export.yml
>The migration starts and fails at:
>== AddOptimisticLocking: migrated (0.4705s) =============
>rake aborted!
>You have a nil object when you didn't expect it!
>You might have expected an instance of Array.
>The error occurred while evaluating nil.delete
>You can review the full rake task log with trace here:

The error you get should be related to the instruction

users_only = {'records' => {'Users' => data['records'].delete('Users')}}

Maybe in the yaml file you have created with the 'export' task there are
no entries for the 'Users' key.

I too have used the import_export extensions with some problems.
I had to tweak the treatment of user data: e.g. in the yaml file I had
to change the value for 'Created by' and 'Updated by'  to "1" (admin
user) or nil otherwise the User object to be saved could not be
instantiated correctly before saving the user record.

I had also to change the create_records method in radiant/setup.rb in
order to maintain the original id's (otherwise associations between
pages and page_parts would be lost):

def create_records(template)
        records = template['records']
        if records
          records.keys.each do |key|
            feedback "Creating #{key.to_s.underscore.humanize}" do
              model = model(key)
                          puts "Created model instance for " + key
                          record_pairs = order_by_id(records[key])

              step do
                record_pairs.each do |id, record|
                  newrec =
                                  #added by Luca to maintain the
imported id
                         = id

Hope this helps.

Luca Erzegovesi
This topic is locked and can not be replied to.