Skip to content

Commit 6798902

Browse files
committed
gen Company model
1 parent 66848cf commit 6798902

File tree

5 files changed

+30
-1
lines changed

5 files changed

+30
-1
lines changed

app/models/company.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Company < ApplicationRecord
2+
validates :name, presence: true
3+
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class CreateCompanies < ActiveRecord::Migration[7.1]
2+
def change
3+
create_table :companies do |t|
4+
t.string :name, null: false
5+
6+
t.timestamps
7+
end
8+
end
9+
end

db/schema.rb

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/companies.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2+
3+
kpmg:
4+
name: KPMG
5+
6+
pwc:
7+
name: PwC

test/models/company_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
require "test_helper"
2+
3+
class CompanyTest < ActiveSupport::TestCase
4+
end

0 commit comments

Comments
 (0)