質問編集履歴

2

編集ミスの修正

2019/05/16 08:42

投稿

shumbow
shumbow

スコア35

test CHANGED
File without changes
test CHANGED
@@ -94,7 +94,7 @@
94
94
 
95
95
  **contract.rb**
96
96
 
97
- ``rb
97
+ ```rb
98
98
 
99
99
  class Contract < ApplicationRecord
100
100
 

1

情報の追加

2019/05/16 08:42

投稿

shumbow
shumbow

スコア35

test CHANGED
File without changes
test CHANGED
@@ -48,7 +48,7 @@
48
48
 
49
49
  **user.rb**
50
50
 
51
- ```erb
51
+ ```rb
52
52
 
53
53
  def add_nil
54
54
 
@@ -90,6 +90,22 @@
90
90
 
91
91
  どなたかわかる方がいらっしゃいましたら ご教授ください。よろしくお願いします。
92
92
 
93
+
94
+
95
+ **contract.rb**
96
+
97
+ ``rb
98
+
99
+ class Contract < ApplicationRecord
100
+
101
+ belongs_to :user, optional: true
102
+
103
+ default_scope -> { order(created_at: :desc) }
104
+
105
+ end
106
+
107
+ ```
108
+
93
109
  **バージョン**
94
110
 
95
111
  rails 5.1.6