I've had issues with YAML::Object when loading DB data before.  Rails
does lazy loading of classes, so they aren't available until
explicitly used.  The YAML loading process doesn't cause them to get
loaded.  You can get around this by explicitly requiring your models
at the top of your script, or doing some hack like this:

[Page, User, Attachment].each do |klass|
  klass.new
end

Then, when your import script is later converting the objects from
YAML they'll become real ActiveRecord objects instead of that
YAML::Object placeholder.

- Jeff

---
Jeff Casimir
Jumpstart Lab by Casimir Creative, LLC
http://jumpstartlab.com
@jumpstartlab on twitter



On Fri, Jun 18, 2010 at 11:48 AM, Marshal Linfoot <mlinf...@gmail.com> wrote:
> I am trying to load my development sqlite3 database into my production mysql
> database using the Super Import/Export extension. This has worked
> previously, but is now throwing an error I don't understand.
> The steps are:
>   rake development db:super_export (to dump the development database)
>   rake production db:super_import (to load back into the production
> database)
> config/database.yml looks like:
> production:
>   adapter: mysql
>   database: myproduction
>   username: myuser
>   password: mypass
>   host: localhost
> development:
>   adapter: sqlite3
>   database: db/development.sqlite3.db
> test:
>   adapter: sqlite3
>   database: db/test.sqlite3.db
> The first step, dumping the development database, finishes without any
> errors. But the second step, loading it back in, produces the following:
>  -- create_table("assets", {:force=>true})
>    -> 0.0385s
> -- create_table("config", {:force=>true})
>    -> 0.0047s
> -- add_index("config", ["key"], {:unique=>true, :name=>"key"})
>    -> 0.0050s
> .... (omitting the rest of the table creates)
> Importing User (1 found)
> Importing Asset (23 found)
> Importing Gallery (4 found)
> Importing GalleryImporting (0 found)
> Importing GalleryItemInfo (0 found)
> Importing GalleryItem (983 found)
> Importing GalleryKeyword (0 found)
> Importing Layout (2 found)
> Importing PageAttachment (4 found)
> Importing PagePart (472 found)
> rake aborted!
> undefined method `save' for #<YAML::Object:0xb6787038>
> (See full trace by running task with --trace)
> Anyone have any ideas? Thanks.
> Running Radiant 0.9 edge
> --
> marshal
>

Reply via email to