Daniel Vartanov
2008-Sep-22 10:49 UTC
Creating database static data (roles, adminstators accounts)
Hello! I have a task to create some static data in database (for instance, bunch of user roles or administrator account). Certainly, we should not create it up in our migrations. If we create them in initializers, we''ll have to check if data is already in DB and even if such table exists (otherwise, rake tasks, even db:migrate will fail). So, is there some brilliant solution? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Erol Fornoles
2008-Sep-22 17:06 UTC
Re: Creating database static data (roles, adminstators accounts)
On Sep 22, 6:49 pm, Daniel Vartanov <daniel.varta...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello! I have a task to create some static data in database (for > instance, bunch of user roles or administrator account). > > Certainly, we should not create it up in our migrations. > > If we create them in initializers, we''ll have to check if data is > already in DB and even if such table exists (otherwise, rake tasks, > even db:migrate will fail). > > So, is there some brilliant solution?How about using a custom rake task? I''m curious though, why can''t you create them via a migration? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@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=en -~----------~----~----~----~------~----~------~--~---