質問編集履歴
1
指摘いただいた内容を試してみました
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -84,4 +84,53 @@
|
|
|
84
84
|
・・・
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
現状、viewには従来のフォーム以外は表示されていません。
|
|
87
|
+
現状、viewには従来のフォーム以外は表示されていません。
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
##追記
|
|
91
|
+
```ruby
|
|
92
|
+
<%= form_with(model: user, local: true) do |form| %>
|
|
93
|
+
<% if user.errors.any? %>
|
|
94
|
+
<div id="error_explanation">
|
|
95
|
+
<h2><%= pluralize(user.errors.count, "error") %> prohibited this user from being saved:</h2>
|
|
96
|
+
|
|
97
|
+
<ul>
|
|
98
|
+
<% user.errors.full_messages.each do |message| %>
|
|
99
|
+
<li><%= message %></li>
|
|
100
|
+
<% end %>
|
|
101
|
+
</ul>
|
|
102
|
+
</div>
|
|
103
|
+
<% end %>
|
|
104
|
+
|
|
105
|
+
<div class="field">
|
|
106
|
+
<%= form.label :name %>
|
|
107
|
+
<%= form.text_field :name, id: :user_name %>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<div class="field">
|
|
111
|
+
<%= form.label :email %>
|
|
112
|
+
<%= form.text_field :email, id: :user_email %>
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<div class="field">
|
|
116
|
+
<div id="star">こんにちは</div>
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
<script>
|
|
120
|
+
$('#star').raty({
|
|
121
|
+
size : 36,
|
|
122
|
+
starOff: '<%= asset_path('star-off.png') %>',
|
|
123
|
+
starOn : '<%= asset_path('star-on.png') %>',
|
|
124
|
+
scoreName: 'user[rate]'
|
|
125
|
+
});
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<div class="actions">
|
|
129
|
+
<%= form.submit %>
|
|
130
|
+
</div>
|
|
131
|
+
<% end %>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
↓
|
|
135
|
+
|
|
136
|
+

|