This is from the blog http://codedecoder.wordpress.com/ . Its about the rake in rails . rake db:seed
rake command is explained in this post . writing custom rake task is explained in this post. db:seed is inbuilt rake task defined by rails. The rake db:seed command, basically execute whatever code you write in db/seeds.rb file of your application. Though can write any code in this file, by convention you should write code which populate your database with the basic data, for example: when ever your deploy your application somewhere, and create a new database for it, you want that user with admin credential must be present there. So you will write the code which create that user in this file. Below is the sample code which will create a user and assign admin role to him.
puts "********Seeding Data Start************" admin = User.create(:first_name => 'System', :last_name => 'Admin', :email => 'email@example.com', :password => 'sunpoweradmin', :password_confirmation => 'sunpoweradmin', :source_system_id => 'systemadmin', :source_system => 'LP',:entity_type => "Customer", :target_system => "OPENAM")…
View original post 277 more words