File tree Expand file tree Collapse file tree 5 files changed +38
-1
lines changed Expand file tree Collapse file tree 5 files changed +38
-1
lines changed Original file line number Diff line number Diff line change
1
+ class ApiKey < ApplicationRecord
2
+ belongs_to :user
3
+ end
Original file line number Diff line number Diff line change
1
+ class CreateApiKeys < ActiveRecord ::Migration [ 5.2 ]
2
+ def change
3
+ create_table :api_keys do |t |
4
+ t . references :user , foreign_key : true
5
+ t . string :key
6
+
7
+ t . timestamps
8
+ end
9
+ end
10
+ end
Original file line number Diff line number Diff line change 10
10
#
11
11
# It's strongly recommended that you check this file into your version control system.
12
12
13
- ActiveRecord ::Schema . define ( version : 2018_09_10_090212 ) do
13
+ ActiveRecord ::Schema . define ( version : 2018_09_17_033731 ) do
14
+
15
+ create_table "api_keys" , force : :cascade do |t |
16
+ t . integer "user_id"
17
+ t . string "key"
18
+ t . datetime "created_at" , null : false
19
+ t . datetime "updated_at" , null : false
20
+ t . index [ "user_id" ] , name : "index_api_keys_on_user_id"
21
+ end
14
22
15
23
create_table "archenemyships" , force : :cascade do |t |
16
24
t . integer "user_id"
Original file line number Diff line number Diff line change
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ one :
4
+ user : one
5
+ key : MyString
6
+
7
+ two :
8
+ user : two
9
+ key : MyString
Original file line number Diff line number Diff line change
1
+ require 'test_helper'
2
+
3
+ class ApiKeyTest < ActiveSupport ::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
You can’t perform that action at this time.
0 commit comments