1
0
Fork 0

Add model Profile

master
Alex Kotov 2 years ago
parent 084f3e9b0d
commit 4883b21b30
  1. 2
      app/models/profile.rb
  2. 10
      db/migrate/20210310092513_create_profiles.rb
  3. 23
      db/schema.rb
  4. 11
      test/fixtures/profiles.yml
  5. 7
      test/models/profile_test.rb

@ -0,0 +1,2 @@
class Profile < ApplicationRecord
end

@ -0,0 +1,10 @@
class CreateProfiles < ActiveRecord::Migration[6.1]
def change
create_table :profiles do |t|
t.timestamps
t.string :first_name
t.string :last_name
t.string :description
end
end
end

23
db/schema.rb generated

@ -0,0 +1,23 @@
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rails
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_03_10_092513) do
create_table "profiles", force: :cascade do |t|
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.string "first_name"
t.string "last_name"
t.string "description"
end
end

@ -0,0 +1,11 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
first_name: Alex
last_name: Kotov
description: Founder
two:
first_name: Oleg
last_name: Ivanov
description: Guy

@ -0,0 +1,7 @@
require "test_helper"
class ProfileTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end