Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

seed data

  • Loading branch information...
commit bece1d17ce24236d69f362e61a0d54196c7f5fd8 1 parent 208118b
@kevivmatrix authored
Showing with 16 additions and 7 deletions.
  1. +16 −7 db/seeds.rb
View
23 db/seeds.rb
@@ -1,7 +1,16 @@
-# This file should contain all the record creation needed to seed the database with its default values.
-# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
-#
-# Examples:
-#
-# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
-# Mayor.create(name: 'Emanuel', city: cities.first)
+# companies
+Company.destroy_all;
+c1 = Company.create name: "CodeBrahma", founded: (Date.today - 1.year)
+
+# office
+Office.destroy_all;
+o1 = Office.create location: "Bangalore", company_id: c1.id
+o2 = Office.create location: "Chennai", company_id: c1.id
+
+# employees
+Employee.destroy_all;
+Employee.create name: "A", designation: "web developer", month_salary: 40000, company_id: c1.id, office_id: o1.id
+Employee.create name: "B", designation: "manager", month_salary: 60000, company_id: c1.id, office_id: o1.id
+Employee.create name: "C", designation: "secretary", month_salary: 20000, company_id: c1.id, office_id: o2.id
+Employee.create name: "D", designation: "receptionist", month_salary: 40000, company_id: c1.id, office_id: o2.id
+Employee.create name: "E", designation: "founder", month_salary: 100000, company_id: c1.id, office_id: o2.id
Please sign in to comment.
Something went wrong with that request. Please try again.