Hey, I was just wondering what you do to handle the initial user setup with a project using authlogic. I''m still in development but what i find annoying is the create new users function is obviously kept in the admin section. I can''t get into the admin section without a user... You see the problem. In most cases i have an admin user setup but now that i''m so far in development everything is being locked down (ie user creating behind closed doors) and if I make a db change and migrate my user table gets wiped out. How should I go about migrating with an initial admin user ? -- 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=en.
On Mon, Dec 28, 2009 at 6:59 AM, brianp <brian.o.pearce-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey, > I was just wondering what you do to handle the initial user setup with > a project using authlogic. > > I''m still in development but what i find annoying is the create new > users function is obviously kept in the admin section. I can''t get > into the admin section without a user... You see the problem. > > In most cases i have an admin user setup but now that i''m so far in > development everything is being locked down (ie user creating behind > closed doors) and if I make a db change and migrate my user table gets > wiped out. > > How should I go about migrating with an initial admin user ? >OK, your question is a bit specific for your application but, one thing you can do is to create a rake task for creating this admin user. -- Leonardo Mateo. There''s no place like ~ -- 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=en.
So as of Rails 2.3.4 they''ve added a seeding function. see http://ryandaigle.com/articles/2009/5/13/what-s-new-in-edge-rails-database-seeding for tutorial. Basically, add a seeds.rb to the db/ folder. Fill it out with any ruby code. I used: User.create(:username => "admin", :password => "temp", :password_confirmation => "temp", :email => "admin-bTQkdIJrLO8@public.gmane.org") puts "Created admin account" then run: rake db:setup This will migrate the schema and fill the db from your seed data. Allows better separation of your seed data from your migration files. And a distinct place to do it instead of assorted rake files. Thankis, for your reply I wouldn''t have found it had i not started to search for rake tasks. On Dec 28, 6:43 am, Leonardo Mateo <leonardoma...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mon, Dec 28, 2009 at 6:59 AM, brianp <brian.o.pea...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hey, > > I was just wondering what you do to handle the initial user setup with > > a project usingauthlogic. > > > I''m still in development but what i find annoying is the create new > > users function is obviously kept in the admin section. I can''t get > > into the admin section without a user... You see the problem. > > > In most cases i have an admin user setup but now that i''m so far in > > development everything is being locked down (ie user creating behind > > closed doors) and if I make a db change and migrate my user table gets > > wiped out. > > > How should I go about migrating with an initial admin user ? > > OK, your question is a bit specific for your application but, one > thing you can do is to create a rake task for creating this admin > user. > > -- > Leonardo Mateo. > There''s no place like ~-- 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=en.