I have a db/seeds.rb file that I want to load, but while the rest of the
seeds file works fine, nothing is ever populated in :users. I just fails
silently, so I can't figure out what exactly is causing the problem.
I have authlogic installed into the user.rb model with
acts_as_authentic. I'm sure that's part of the problem, but I'm not sure
that manually turning it off each time I run the db:seed task is the
right thing to do.
Has anyone else seen this behavior, and how can I work around it?
Hard to say without seeing the seeds file, but, this generally happens
when it fails the validation. Try using save! instead of save. That
will cause a stacktrace which will let you know what was missed.
Darian Shimy
This was exactly what I needed. Adding:
User.find_or_create_by_email(
#stuff
).save!
with the right data showed me which validations were failing, and I was
able to fix them. All is now right with the world.
As an added bonus, authlogic is now properly populating the password
fields from cleartext passwords, so I don't even need to pre-populate
:crypted_password anymore. Woohoo!
Thanks for the timely help.