In data-drive development environment we need couple of pre-existing data in our application. Literally in your rails application if we wish to deploy few dummy / starting data then we can use seed and execute it in deployment script (everytime when a new app is installed).
-We will place our dummy records in our db/seeds.rb file and execute it using rake db:seed command.
Let’s get down to code business :
db / seeds.rb
james = User.create!(:name => "James Brito", :location => "Chicago")
dean = User.create!(:name => "Dean Winchester", :location => "NYK")
sammy = User.create!(:name => "Sam Winchester", :location => "NYK")
we are just happy with above 3 dummy users for our application so let’s commit it by using command
$ rake db:seed
Now check in console mode
$ rails c