Skip to content

Commit 832bf40

Browse files
authored
Merge pull request #477 from datafruits/accessories-shop
accessories-shop
2 parents 81e1ef7 + 5b7a5fe commit 832bf40

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

app/models/accessory.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class Accessory < ApplicationRecord
2+
end

app/models/user_accessory.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class UserAccessory < ApplicationRecord
2+
belongs_to :accessory
3+
belongs_to :user
4+
end
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class CreateAccessories < ActiveRecord::Migration[7.0]
2+
def change
3+
create_table :accessories do |t|
4+
t.string :name
5+
t.integer :amount
6+
7+
t.timestamps
8+
end
9+
end
10+
end
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class CreateUserAccessories < ActiveRecord::Migration[7.0]
2+
def change
3+
create_table :user_accessories do |t|
4+
t.references :accessory
5+
t.references :user
6+
7+
t.timestamps
8+
end
9+
end
10+
end

0 commit comments

Comments
 (0)