質問編集履歴

3

viewファイルを追加しました

2019/03/01 04:53

投稿

haruka1997
haruka1997

スコア12

test CHANGED
File without changes
test CHANGED
@@ -8,314 +8,6 @@
8
8
 
9
9
 
10
10
 
11
- ``````index.html.erb
12
-
13
- NoMethodError in Goodthing#index
14
-
15
- Showing /home/ec2-user/environment/web-app/app/views/goodthing/index.html.erb where line #21 raised:
16
-
17
-
18
-
19
- private method `select' called for nil:NilClass
20
-
21
- Extracted source (around line #21):
22
-
23
-
24
-
25
- 18 <div style="padding-top: 0;">
26
-
27
- 19 <div style="float: left; clear: none; padding-top: 0; padding-buttom: 0;">
28
-
29
- 20 <label><%= t(".full_name") %></label>
30
-
31
- 21   <%= f.select :name, @users_name, {:include_blank => 'true'}, {:class => 'search_combobox'} %>
32
-
33
- 22 </div>
34
-
35
- 23 </div>
36
-
37
- 24 <div style="padding-top: 0;">
38
-
39
- ```
40
-
41
-
42
-
43
- viewはこちらになります。
44
-
45
- ```
46
-
47
- <div class="box">
48
-
49
- <p>
50
-
51
- <%= t(".goodthing")%>
52
-
53
- </p>
54
-
55
- <div>
56
-
57
- <!--検索フォーム-->
58
-
59
- <div>
60
-
61
- <%= form_tag(goodthing_path, :method => :get) do |f| %>
62
-
63
- <fieldset>
64
-
65
- <!-- datepicker部分 -->
66
-
67
- <legend><%= t(".filter") %></legend>
68
-
69
- <div>
70
-
71
- <div style="float: left; clear: none; padding-top: 0; padding-buttom: 0;">
72
-
73
- <label><%= t(".date") %></label>
74
-
75
- <input type="text" name="date" class="datepicker">~<input type="text" name="date" class="datepicker">
76
-
77
- </div>
78
-
79
- </div>
80
-
81
- <div style="padding-top: 0;">
82
-
83
- <div style="float: left; clear: none; padding-top: 0; padding-buttom: 0;">
84
-
85
- <label><%= t(".full_name") %></label>
86
-
87
-   <%= f.select :name, @users_name, {:include_blank => 'true'}, {:class => 'search_combobox'} %>
88
-
89
- </div>
90
-
91
- </div>
92
-
93
- <div style="padding-top: 0;">
94
-
95
- <div style="float: left; clear: none; padding-top: 0; padding-buttom: 0;">
96
-
97
- <label><%= t(".membership") %></label>
98
-
99
- <%= text_field_tag "search[membership]", @membership %>
100
-
101
- </div>
102
-
103
- <div class="btn-box" style="float: right;">
104
-
105
- <%= submit_tag(t(".search")) %>
106
-
107
- </div>
108
-
109
- </div>
110
-
111
- </fieldset>
112
-
113
- <% end %>
114
-
115
- </div>
116
-
117
-  <div style="float: right;"><%= link_to t(".csv_download"), goodthing_path(format: :csv, goodthing_form: {from_to: @from_to, sort_key: "total_point", sort_order: 'desc'}) %></div>
118
-
119
-
120
-
121
- <div class="goodthing" style="padding-bottom: 0px;">
122
-
123
- <% if @search_date %>
124
-
125
- <h3><%= Date.parse(@search_date).strftime(t".search_date_result") + t(".goodthing") %></h3>
126
-
127
- <% end %>
128
-
129
- </div>
130
-
131
- <table class="table" style="margin-top: 0px;">
132
-
133
- <thead>
134
-
135
- <tr>
136
-
137
- <th>
138
-
139
- <%= t(".name") %>
140
-
141
- </th>
142
-
143
- <th>
144
-
145
- <%= t(".date") %>
146
-
147
- </th>
148
-
149
- <th>
150
-
151
- <%= t(".comment") %>
152
-
153
- </th>
154
-
155
- </tr>
156
-
157
- </thead>
158
-
159
-
160
-
161
- <% if @search_date %>
162
-
163
- <tbody>
164
-
165
- <% @users.each do |user| %>
166
-
167
- <tr>
168
-
169
- <td rowspan="3">
170
-
171
- <%= user.profile.name %>
172
-
173
- </td>
174
-
175
- <td>
176
-
177
- <%= t(".done") %>
178
-
179
- </td>
180
-
181
- <td>
182
-
183
- <% if user.goodthing.find_by(recorded_on: @search_date).present? %>
184
-
185
- <%= user.goodthing.find_by(recorded_on: @search_date).message1 %>
186
-
187
- <% end %>
188
-
189
- </td>
190
-
191
- </tr>
192
-
193
- <tr>
194
-
195
- <td>
196
-
197
- <%= t(".happy") %>
198
-
199
- </td>
200
-
201
- <td>
202
-
203
- <% if user.goodthings.find_by(recorded_on: @search_date).present? %>
204
-
205
- <%= user.goodthing.find_by(recorded_on: @search_date).message2 %>
206
-
207
- <% end %>
208
-
209
- </td>
210
-
211
- </tr>
212
-
213
- <tr>
214
-
215
- <td>
216
-
217
- <%= t(".learned") %>
218
-
219
- </td>
220
-
221
- <td>
222
-
223
- <% if user.goodthing.find_by(recorded_on: @search_date).present? %>
224
-
225
- <%= user.goodthing.find_by(recorded_on: @search_date).message3 %>
226
-
227
- <% end %>
228
-
229
- </td>
230
-
231
- </tr>
232
-
233
- <% end %>
234
-
235
- </tbody>
236
-
237
- <% end %>
238
-
239
- </table>
240
-
241
- </div>
242
-
243
- </div>
244
-
245
-
246
-
247
-
248
-
249
- <!-- datepicker部分-->
250
-
251
- <script>
252
-
253
- $(function(){
254
-
255
- $("#datepicker").datepicker({
256
-
257
- buttonImageOnly: true,
258
-
259
- buttonImage: "<%= asset_path('calender.png') %>"
260
-
261
- });
262
-
263
- });
264
-
265
- </script>
266
-
267
-
268
-
269
- <script>
270
-
271
- $(function(){
272
-
273
- $(".search_combobox").combobox()
274
-
275
- });
276
-
277
- </script>
278
-
279
- ```
280
-
281
-
282
-
283
- ちなみに、controllerはこちらになります。
284
-
285
- ```
286
-
287
- class GoodthingController < BaseController
288
-
289
-
290
-
291
- set_function_label :user_management
292
-
293
- end
294
-
295
-
296
-
297
- def index
298
-
299
-  @goodthing_form = GoodthingForm.new(goodthing_form_params)
300
-
301
- @date_from = @goodthing_form.from
302
-
303
- @date_to = @goodthing_form.to
304
-
305
- @name = @goodthing_form.name
306
-
307
- @group = @goodthing_form.group
308
-
309
- @users_name = current_organization.users.without_soft_destroyed.map {|user| user.profile.name }
310
-
311
- @groups_name = current_organization.groups.map {|group| group.name }
312
-
313
-
314
-
315
-
316
-
317
- ```
318
-
319
11
  コントローラー側で@users_nameを修正しなきゃいけないのかな?と思いつつ
320
12
 
321
13
  どうすればいいかググってもわからなかったので質問させていただきました。

2

viewファイルを追加しました

2019/03/01 04:53

投稿

haruka1997
haruka1997

スコア12

test CHANGED
File without changes
test CHANGED
@@ -84,7 +84,7 @@
84
84
 
85
85
  <label><%= t(".full_name") %></label>
86
86
 
87
-   <%= select :name, @users_name, {:include_blank => 'true'}, {:class => 'search_combobox'} %>
87
+   <%= f.select :name, @users_name, {:include_blank => 'true'}, {:class => 'search_combobox'} %>
88
88
 
89
89
  </div>
90
90
 

1

viewファイルを追加しました。

2019/03/01 02:10

投稿

haruka1997
haruka1997

スコア12

test CHANGED
File without changes
test CHANGED
@@ -40,6 +40,244 @@
40
40
 
41
41
 
42
42
 
43
+ viewはこちらになります。
44
+
45
+ ```
46
+
47
+ <div class="box">
48
+
49
+ <p>
50
+
51
+ <%= t(".goodthing")%>
52
+
53
+ </p>
54
+
55
+ <div>
56
+
57
+ <!--検索フォーム-->
58
+
59
+ <div>
60
+
61
+ <%= form_tag(goodthing_path, :method => :get) do |f| %>
62
+
63
+ <fieldset>
64
+
65
+ <!-- datepicker部分 -->
66
+
67
+ <legend><%= t(".filter") %></legend>
68
+
69
+ <div>
70
+
71
+ <div style="float: left; clear: none; padding-top: 0; padding-buttom: 0;">
72
+
73
+ <label><%= t(".date") %></label>
74
+
75
+ <input type="text" name="date" class="datepicker">~<input type="text" name="date" class="datepicker">
76
+
77
+ </div>
78
+
79
+ </div>
80
+
81
+ <div style="padding-top: 0;">
82
+
83
+ <div style="float: left; clear: none; padding-top: 0; padding-buttom: 0;">
84
+
85
+ <label><%= t(".full_name") %></label>
86
+
87
+   <%= select :name, @users_name, {:include_blank => 'true'}, {:class => 'search_combobox'} %>
88
+
89
+ </div>
90
+
91
+ </div>
92
+
93
+ <div style="padding-top: 0;">
94
+
95
+ <div style="float: left; clear: none; padding-top: 0; padding-buttom: 0;">
96
+
97
+ <label><%= t(".membership") %></label>
98
+
99
+ <%= text_field_tag "search[membership]", @membership %>
100
+
101
+ </div>
102
+
103
+ <div class="btn-box" style="float: right;">
104
+
105
+ <%= submit_tag(t(".search")) %>
106
+
107
+ </div>
108
+
109
+ </div>
110
+
111
+ </fieldset>
112
+
113
+ <% end %>
114
+
115
+ </div>
116
+
117
+  <div style="float: right;"><%= link_to t(".csv_download"), goodthing_path(format: :csv, goodthing_form: {from_to: @from_to, sort_key: "total_point", sort_order: 'desc'}) %></div>
118
+
119
+
120
+
121
+ <div class="goodthing" style="padding-bottom: 0px;">
122
+
123
+ <% if @search_date %>
124
+
125
+ <h3><%= Date.parse(@search_date).strftime(t".search_date_result") + t(".goodthing") %></h3>
126
+
127
+ <% end %>
128
+
129
+ </div>
130
+
131
+ <table class="table" style="margin-top: 0px;">
132
+
133
+ <thead>
134
+
135
+ <tr>
136
+
137
+ <th>
138
+
139
+ <%= t(".name") %>
140
+
141
+ </th>
142
+
143
+ <th>
144
+
145
+ <%= t(".date") %>
146
+
147
+ </th>
148
+
149
+ <th>
150
+
151
+ <%= t(".comment") %>
152
+
153
+ </th>
154
+
155
+ </tr>
156
+
157
+ </thead>
158
+
159
+
160
+
161
+ <% if @search_date %>
162
+
163
+ <tbody>
164
+
165
+ <% @users.each do |user| %>
166
+
167
+ <tr>
168
+
169
+ <td rowspan="3">
170
+
171
+ <%= user.profile.name %>
172
+
173
+ </td>
174
+
175
+ <td>
176
+
177
+ <%= t(".done") %>
178
+
179
+ </td>
180
+
181
+ <td>
182
+
183
+ <% if user.goodthing.find_by(recorded_on: @search_date).present? %>
184
+
185
+ <%= user.goodthing.find_by(recorded_on: @search_date).message1 %>
186
+
187
+ <% end %>
188
+
189
+ </td>
190
+
191
+ </tr>
192
+
193
+ <tr>
194
+
195
+ <td>
196
+
197
+ <%= t(".happy") %>
198
+
199
+ </td>
200
+
201
+ <td>
202
+
203
+ <% if user.goodthings.find_by(recorded_on: @search_date).present? %>
204
+
205
+ <%= user.goodthing.find_by(recorded_on: @search_date).message2 %>
206
+
207
+ <% end %>
208
+
209
+ </td>
210
+
211
+ </tr>
212
+
213
+ <tr>
214
+
215
+ <td>
216
+
217
+ <%= t(".learned") %>
218
+
219
+ </td>
220
+
221
+ <td>
222
+
223
+ <% if user.goodthing.find_by(recorded_on: @search_date).present? %>
224
+
225
+ <%= user.goodthing.find_by(recorded_on: @search_date).message3 %>
226
+
227
+ <% end %>
228
+
229
+ </td>
230
+
231
+ </tr>
232
+
233
+ <% end %>
234
+
235
+ </tbody>
236
+
237
+ <% end %>
238
+
239
+ </table>
240
+
241
+ </div>
242
+
243
+ </div>
244
+
245
+
246
+
247
+
248
+
249
+ <!-- datepicker部分-->
250
+
251
+ <script>
252
+
253
+ $(function(){
254
+
255
+ $("#datepicker").datepicker({
256
+
257
+ buttonImageOnly: true,
258
+
259
+ buttonImage: "<%= asset_path('calender.png') %>"
260
+
261
+ });
262
+
263
+ });
264
+
265
+ </script>
266
+
267
+
268
+
269
+ <script>
270
+
271
+ $(function(){
272
+
273
+ $(".search_combobox").combobox()
274
+
275
+ });
276
+
277
+ </script>
278
+
279
+ ```
280
+
43
281
 
44
282
 
45
283
  ちなみに、controllerはこちらになります。