Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Creating a Code School in the Rails Console

Harry Levine edited this page Mar 24, 2018 · 2 revisions

In total, a code school is comprised of a CodeSchool record, and an associated Location record.

Here is an example of how to create a new CodeSchool, and a new Location for that school, in the rails console:

code_school = CodeSchool.create(
  name: "Wyncode Academy",
  url: "http://wyncode.co",
  logo:
  "https://raw.githubusercontent.com/OperationCode/operationcode_frontend/master/src/images/codeSchoolLogos/wyncode.jpg",
  full_time: true,
  hardware_included: false,
  has_online: false,
  online_only: false,
  notes: nil,
  mooc: true
)

code_school.locations.create(
  va_accepted: true,
  address1: "549 NW 28th Street",
  address2: nil,
  city: "Miami",
  state: "FL",
  zip: 33127,
)

Each of these models have required attributes. They are:

CodeSchool required attributes:

:name, :url, :logo

Location required attributes:

:address1, :city, :state, :zip