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.
Jonathan M. (Guest)
on 2007-05-31 20: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?


Sean C. (Guest)
on 2007-05-31 20: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.

David Minor (Guest)
on 2007-05-31 20: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.

Luca E. (Guest)
on 2007-06-01 17: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.