質問編集履歴

1

_member_formの追加

2019/12/14 13:26

投稿

sn.jr
sn.jr

スコア53

test CHANGED
File without changes
test CHANGED
@@ -28,6 +28,64 @@
28
28
 
29
29
  ```
30
30
 
31
+ ```rb
32
+
33
+ <%= render "shared/errors", obj: @member %>
34
+
35
+ <table class="attr">
36
+
37
+ <tr>
38
+
39
+ <th><%= form.label :name %></th>
40
+
41
+ <td><%= form.text_field :name %></td>
42
+
43
+ </tr>
44
+
45
+ <tr>
46
+
47
+ <th><%= form.label :birthday,
48
+
49
+ for: "member_birthday_li"%></th>
50
+
51
+ <td><%= form.date_select :birthday,
52
+
53
+ start_year: 1970, end_year: Time.current.year,
54
+
55
+ use_month_numbers: true%></td>
56
+
57
+ </tr>
58
+
59
+ <% if controller.kind_of?(MembersController)%>
60
+
61
+ <tr>
62
+
63
+ <th><%= form.label :email %></th>
64
+
65
+ <td><%= form.text_field :email %></td>
66
+
67
+ </tr>
68
+
69
+ <tr>
70
+
71
+ <th><%= Member.human_attribute_name(:administrator) %></th>
72
+
73
+ <td>
74
+
75
+ <%= form.check_box :administrator %>
76
+
77
+ <%= form.label :administrator %>
78
+
79
+ </td>
80
+
81
+ </tr>
82
+
83
+ <%end%>
84
+
85
+ </table>
86
+
87
+ ```
88
+
31
89
  ###試したこと
32
90
 
33
91
  @member.assign_attributes(params[:account])の部分を決してみたら、@member.saveできたので問題は@member.assign_attributes(params[:account])にあるかと推測します。