added seed to populate initial data.

This commit is contained in:
amalrik 2015-05-10 12:17:57 -03:00
parent c04c752648
commit 440d060820
2 changed files with 8 additions and 5 deletions

View file

@ -78,12 +78,11 @@ in a `config/initializers/production.rb` or similar file:
Rails.application.routes.default_url_options[:host] = Rails.application.domain
* Create an initial administrator user and at least one tag:
* Seed the database to create an initial administrator user and at least one tag:
lobsters$ rails console
Loading development environment (Rails 4.1.8)
irb(main):001:0> User.create(:username => "test", :email => "test@example.com", :password => "test", :password_confirmation => "test", :is_admin => true, :is_moderator => true)
irb(main):002:0> Tag.create(:tag => "test")
lobsters$ rake db:seed
created user: test, password: test
created tag: test
* Run the Rails server in development mode. You should be able to login to
`http://localhost:3000` with your new `test` user:

4
db/seeds.rb Normal file
View file

@ -0,0 +1,4 @@
User.create(:username => "test", :email => "test@example.com", :password => "test", :password_confirmation => "test", :is_admin => true, :is_moderator => true)
puts "created user: test, password: test"
Tag.create(:tag => "test")
puts "created tag: test"