Skip to content

Commit

Permalink
Agregar table Shareable
Browse files Browse the repository at this point in the history
  • Loading branch information
luciagirasoles committed Aug 18, 2022
1 parent caa961c commit 5fc940e
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/models/share.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Share < ApplicationRecord
belongs_to :user
end
10 changes: 10 additions & 0 deletions db/migrate/20220818004701_create_shares.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateShares < ActiveRecord::Migration[7.0]
def change
create_table :shares do |t|
t.references :user, null: false, foreign_key: true
t.references :shareable, polymorphic: true

t.timestamps
end
end
end
13 changes: 12 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions test/fixtures/shares.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

one:
user: one

two:
user: two
7 changes: 7 additions & 0 deletions test/models/share_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require "test_helper"

class ShareTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

0 comments on commit 5fc940e

Please sign in to comment.