More YAML and rake nonsense

My attempts at building custom rake tasks to pre-load initial data for applications continues, and is another widely reported problem.

I have two models, User and Role both in my app/models directory as you’d expect. I do all standard stuff to set up the environment in rake, there are no structural differences at all in the code.

The rake task use users works fine but for roles I get,

rake aborted!
ArgumentError: undefined class/module Role
../lib/taksks/post_migrate_roles.rake:6:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:task_prep_roles
(See full trace by running task with --trace)

Indicating a potential problem with the YAML file; the only difference being the user yml has,

- !ruby/object:User
   id: 1

and the roles.yml has

- !ruby/object:Role
   id: 1

There might be something problems with serialised object at but it’s quite deep and I’m including it here as a reminder to check out later.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s