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? -- "Oh, look: rocks!" -- Doctor Who, "Destiny of the Daleks" -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=.
Darian Shimy
2009-Nov-17 22:41 UTC
Re: rake db:seed with authlogic fails to populate users
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 -- http://www.darianshimy.com http://twitter.com/dshimy On Tue, Nov 17, 2009 at 1:48 PM, Todd A. Jacobs <tjacobs-sndr-b4faac-S/bPM5e9wgfNLxjTenLetw@public.gmane.org> wrote:> 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? > > -- > "Oh, look: rocks!" > -- Doctor Who, "Destiny of the Daleks" > > -- > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=.
Todd A. Jacobs
2009-Nov-17 23:05 UTC
Re: rake db:seed with authlogic fails to populate users
On Tue, Nov 17, 2009 at 02:41:29PM -0800, Darian Shimy wrote:> 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.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. -- "Oh, look: rocks!" -- Doctor Who, "Destiny of the Daleks" -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=.