質問編集履歴
1
コードの追加
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
エラー文を解決した(ruby on rails)
|
1
|
+
エラー文を解決したい(ruby on rails)
|
test
CHANGED
@@ -5,3 +5,77 @@
|
|
5
5
|
エラー文の詳細
|
6
6
|
|
7
7
|
undefined method `arity' for :deadlines:Symbol (NoMethodError)
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
#コード
|
12
|
+
|
13
|
+
**deadline_controller.rb**
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
class DeadlineController < ApplicationController
|
20
|
+
|
21
|
+
def new
|
22
|
+
|
23
|
+
@deadline = Deadline.new
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
def create
|
30
|
+
|
31
|
+
binding.pry
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
```
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
**deadline.rb**
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
class Deadline < ApplicationRecord
|
48
|
+
|
49
|
+
has_many :deadline_tasks
|
50
|
+
|
51
|
+
belongs_to :user
|
52
|
+
|
53
|
+
validates :name, presence: true, uniqueness: true
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
```
|
58
|
+
|
59
|
+
**20200924021651_create_deadlines.rb**
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
class CreateDeadlines < ActiveRecord::Migration[6.0]
|
66
|
+
|
67
|
+
def change
|
68
|
+
|
69
|
+
create_table :deadlines do |t|
|
70
|
+
|
71
|
+
t.string :name, null: false
|
72
|
+
|
73
|
+
t.timestamps
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
```
|