質問編集履歴
3
viewファイルを追加しました
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -3,160 +3,6 @@
|
|
|
3
3
|
名前の検索ボックスを実装中に以下のエラーメッセージが発生しました。
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
``````index.html.erb
|
|
7
|
-
NoMethodError in Goodthing#index
|
|
8
|
-
Showing /home/ec2-user/environment/web-app/app/views/goodthing/index.html.erb where line #21 raised:
|
|
9
|
-
|
|
10
|
-
private method `select' called for nil:NilClass
|
|
11
|
-
Extracted source (around line #21):
|
|
12
|
-
|
|
13
|
-
18 <div style="padding-top: 0;">
|
|
14
|
-
19 <div style="float: left; clear: none; padding-top: 0; padding-buttom: 0;">
|
|
15
|
-
20 <label><%= t(".full_name") %></label>
|
|
16
|
-
21 <%= f.select :name, @users_name, {:include_blank => 'true'}, {:class => 'search_combobox'} %>
|
|
17
|
-
22 </div>
|
|
18
|
-
23 </div>
|
|
19
|
-
24 <div style="padding-top: 0;">
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
viewはこちらになります。
|
|
23
|
-
```
|
|
24
|
-
<div class="box">
|
|
25
|
-
<p>
|
|
26
|
-
<%= t(".goodthing")%>
|
|
27
|
-
</p>
|
|
28
|
-
<div>
|
|
29
|
-
<!--検索フォーム-->
|
|
30
|
-
<div>
|
|
31
|
-
<%= form_tag(goodthing_path, :method => :get) do |f| %>
|
|
32
|
-
<fieldset>
|
|
33
|
-
<!-- datepicker部分 -->
|
|
34
|
-
<legend><%= t(".filter") %></legend>
|
|
35
|
-
<div>
|
|
36
|
-
<div style="float: left; clear: none; padding-top: 0; padding-buttom: 0;">
|
|
37
|
-
<label><%= t(".date") %></label>
|
|
38
|
-
<input type="text" name="date" class="datepicker">~<input type="text" name="date" class="datepicker">
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
<div style="padding-top: 0;">
|
|
42
|
-
<div style="float: left; clear: none; padding-top: 0; padding-buttom: 0;">
|
|
43
|
-
<label><%= t(".full_name") %></label>
|
|
44
|
-
<%= f.select :name, @users_name, {:include_blank => 'true'}, {:class => 'search_combobox'} %>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
<div style="padding-top: 0;">
|
|
48
|
-
<div style="float: left; clear: none; padding-top: 0; padding-buttom: 0;">
|
|
49
|
-
<label><%= t(".membership") %></label>
|
|
50
|
-
<%= text_field_tag "search[membership]", @membership %>
|
|
51
|
-
</div>
|
|
52
|
-
<div class="btn-box" style="float: right;">
|
|
53
|
-
<%= submit_tag(t(".search")) %>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
</fieldset>
|
|
57
|
-
<% end %>
|
|
58
|
-
</div>
|
|
59
|
-
<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>
|
|
60
|
-
|
|
61
|
-
<div class="goodthing" style="padding-bottom: 0px;">
|
|
62
|
-
<% if @search_date %>
|
|
63
|
-
<h3><%= Date.parse(@search_date).strftime(t".search_date_result") + t(".goodthing") %></h3>
|
|
64
|
-
<% end %>
|
|
65
|
-
</div>
|
|
66
|
-
<table class="table" style="margin-top: 0px;">
|
|
67
|
-
<thead>
|
|
68
|
-
<tr>
|
|
69
|
-
<th>
|
|
70
|
-
<%= t(".name") %>
|
|
71
|
-
</th>
|
|
72
|
-
<th>
|
|
73
|
-
<%= t(".date") %>
|
|
74
|
-
</th>
|
|
75
|
-
<th>
|
|
76
|
-
<%= t(".comment") %>
|
|
77
|
-
</th>
|
|
78
|
-
</tr>
|
|
79
|
-
</thead>
|
|
80
|
-
|
|
81
|
-
<% if @search_date %>
|
|
82
|
-
<tbody>
|
|
83
|
-
<% @users.each do |user| %>
|
|
84
|
-
<tr>
|
|
85
|
-
<td rowspan="3">
|
|
86
|
-
<%= user.profile.name %>
|
|
87
|
-
</td>
|
|
88
|
-
<td>
|
|
89
|
-
<%= t(".done") %>
|
|
90
|
-
</td>
|
|
91
|
-
<td>
|
|
92
|
-
<% if user.goodthing.find_by(recorded_on: @search_date).present? %>
|
|
93
|
-
<%= user.goodthing.find_by(recorded_on: @search_date).message1 %>
|
|
94
|
-
<% end %>
|
|
95
|
-
</td>
|
|
96
|
-
</tr>
|
|
97
|
-
<tr>
|
|
98
|
-
<td>
|
|
99
|
-
<%= t(".happy") %>
|
|
100
|
-
</td>
|
|
101
|
-
<td>
|
|
102
|
-
<% if user.goodthings.find_by(recorded_on: @search_date).present? %>
|
|
103
|
-
<%= user.goodthing.find_by(recorded_on: @search_date).message2 %>
|
|
104
|
-
<% end %>
|
|
105
|
-
</td>
|
|
106
|
-
</tr>
|
|
107
|
-
<tr>
|
|
108
|
-
<td>
|
|
109
|
-
<%= t(".learned") %>
|
|
110
|
-
</td>
|
|
111
|
-
<td>
|
|
112
|
-
<% if user.goodthing.find_by(recorded_on: @search_date).present? %>
|
|
113
|
-
<%= user.goodthing.find_by(recorded_on: @search_date).message3 %>
|
|
114
|
-
<% end %>
|
|
115
|
-
</td>
|
|
116
|
-
</tr>
|
|
117
|
-
<% end %>
|
|
118
|
-
</tbody>
|
|
119
|
-
<% end %>
|
|
120
|
-
</table>
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
<!-- datepicker部分-->
|
|
126
|
-
<script>
|
|
127
|
-
$(function(){
|
|
128
|
-
$("#datepicker").datepicker({
|
|
129
|
-
buttonImageOnly: true,
|
|
130
|
-
buttonImage: "<%= asset_path('calender.png') %>"
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
</script>
|
|
134
|
-
|
|
135
|
-
<script>
|
|
136
|
-
$(function(){
|
|
137
|
-
$(".search_combobox").combobox()
|
|
138
|
-
});
|
|
139
|
-
</script>
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
ちなみに、controllerはこちらになります。
|
|
143
|
-
```
|
|
144
|
-
class GoodthingController < BaseController
|
|
145
|
-
|
|
146
|
-
set_function_label :user_management
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
def index
|
|
150
|
-
@goodthing_form = GoodthingForm.new(goodthing_form_params)
|
|
151
|
-
@date_from = @goodthing_form.from
|
|
152
|
-
@date_to = @goodthing_form.to
|
|
153
|
-
@name = @goodthing_form.name
|
|
154
|
-
@group = @goodthing_form.group
|
|
155
|
-
@users_name = current_organization.users.without_soft_destroyed.map {|user| user.profile.name }
|
|
156
|
-
@groups_name = current_organization.groups.map {|group| group.name }
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
```
|
|
160
6
|
コントローラー側で@users_nameを修正しなきゃいけないのかな?と思いつつ
|
|
161
7
|
どうすればいいかググってもわからなかったので質問させていただきました。
|
|
162
8
|
どなたか教えていただければ幸いです。
|
2
viewファイルを追加しました
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
<div style="padding-top: 0;">
|
|
42
42
|
<div style="float: left; clear: none; padding-top: 0; padding-buttom: 0;">
|
|
43
43
|
<label><%= t(".full_name") %></label>
|
|
44
|
-
<%= select :name, @users_name, {:include_blank => 'true'}, {:class => 'search_combobox'} %>
|
|
44
|
+
<%= f.select :name, @users_name, {:include_blank => 'true'}, {:class => 'search_combobox'} %>
|
|
45
45
|
</div>
|
|
46
46
|
</div>
|
|
47
47
|
<div style="padding-top: 0;">
|
1
viewファイルを追加しました。
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -19,7 +19,126 @@
|
|
|
19
19
|
24 <div style="padding-top: 0;">
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
viewはこちらになります。
|
|
23
|
+
```
|
|
24
|
+
<div class="box">
|
|
25
|
+
<p>
|
|
26
|
+
<%= t(".goodthing")%>
|
|
27
|
+
</p>
|
|
28
|
+
<div>
|
|
29
|
+
<!--検索フォーム-->
|
|
30
|
+
<div>
|
|
31
|
+
<%= form_tag(goodthing_path, :method => :get) do |f| %>
|
|
32
|
+
<fieldset>
|
|
33
|
+
<!-- datepicker部分 -->
|
|
34
|
+
<legend><%= t(".filter") %></legend>
|
|
35
|
+
<div>
|
|
36
|
+
<div style="float: left; clear: none; padding-top: 0; padding-buttom: 0;">
|
|
37
|
+
<label><%= t(".date") %></label>
|
|
38
|
+
<input type="text" name="date" class="datepicker">~<input type="text" name="date" class="datepicker">
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
<div style="padding-top: 0;">
|
|
42
|
+
<div style="float: left; clear: none; padding-top: 0; padding-buttom: 0;">
|
|
43
|
+
<label><%= t(".full_name") %></label>
|
|
44
|
+
<%= select :name, @users_name, {:include_blank => 'true'}, {:class => 'search_combobox'} %>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
<div style="padding-top: 0;">
|
|
48
|
+
<div style="float: left; clear: none; padding-top: 0; padding-buttom: 0;">
|
|
49
|
+
<label><%= t(".membership") %></label>
|
|
50
|
+
<%= text_field_tag "search[membership]", @membership %>
|
|
51
|
+
</div>
|
|
52
|
+
<div class="btn-box" style="float: right;">
|
|
53
|
+
<%= submit_tag(t(".search")) %>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</fieldset>
|
|
57
|
+
<% end %>
|
|
58
|
+
</div>
|
|
59
|
+
<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>
|
|
60
|
+
|
|
61
|
+
<div class="goodthing" style="padding-bottom: 0px;">
|
|
62
|
+
<% if @search_date %>
|
|
63
|
+
<h3><%= Date.parse(@search_date).strftime(t".search_date_result") + t(".goodthing") %></h3>
|
|
64
|
+
<% end %>
|
|
65
|
+
</div>
|
|
66
|
+
<table class="table" style="margin-top: 0px;">
|
|
67
|
+
<thead>
|
|
68
|
+
<tr>
|
|
69
|
+
<th>
|
|
70
|
+
<%= t(".name") %>
|
|
71
|
+
</th>
|
|
72
|
+
<th>
|
|
73
|
+
<%= t(".date") %>
|
|
74
|
+
</th>
|
|
75
|
+
<th>
|
|
76
|
+
<%= t(".comment") %>
|
|
77
|
+
</th>
|
|
78
|
+
</tr>
|
|
79
|
+
</thead>
|
|
22
80
|
|
|
81
|
+
<% if @search_date %>
|
|
82
|
+
<tbody>
|
|
83
|
+
<% @users.each do |user| %>
|
|
84
|
+
<tr>
|
|
85
|
+
<td rowspan="3">
|
|
86
|
+
<%= user.profile.name %>
|
|
87
|
+
</td>
|
|
88
|
+
<td>
|
|
89
|
+
<%= t(".done") %>
|
|
90
|
+
</td>
|
|
91
|
+
<td>
|
|
92
|
+
<% if user.goodthing.find_by(recorded_on: @search_date).present? %>
|
|
93
|
+
<%= user.goodthing.find_by(recorded_on: @search_date).message1 %>
|
|
94
|
+
<% end %>
|
|
95
|
+
</td>
|
|
96
|
+
</tr>
|
|
97
|
+
<tr>
|
|
98
|
+
<td>
|
|
99
|
+
<%= t(".happy") %>
|
|
100
|
+
</td>
|
|
101
|
+
<td>
|
|
102
|
+
<% if user.goodthings.find_by(recorded_on: @search_date).present? %>
|
|
103
|
+
<%= user.goodthing.find_by(recorded_on: @search_date).message2 %>
|
|
104
|
+
<% end %>
|
|
105
|
+
</td>
|
|
106
|
+
</tr>
|
|
107
|
+
<tr>
|
|
108
|
+
<td>
|
|
109
|
+
<%= t(".learned") %>
|
|
110
|
+
</td>
|
|
111
|
+
<td>
|
|
112
|
+
<% if user.goodthing.find_by(recorded_on: @search_date).present? %>
|
|
113
|
+
<%= user.goodthing.find_by(recorded_on: @search_date).message3 %>
|
|
114
|
+
<% end %>
|
|
115
|
+
</td>
|
|
116
|
+
</tr>
|
|
117
|
+
<% end %>
|
|
118
|
+
</tbody>
|
|
119
|
+
<% end %>
|
|
120
|
+
</table>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
<!-- datepicker部分-->
|
|
126
|
+
<script>
|
|
127
|
+
$(function(){
|
|
128
|
+
$("#datepicker").datepicker({
|
|
129
|
+
buttonImageOnly: true,
|
|
130
|
+
buttonImage: "<%= asset_path('calender.png') %>"
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
</script>
|
|
134
|
+
|
|
135
|
+
<script>
|
|
136
|
+
$(function(){
|
|
137
|
+
$(".search_combobox").combobox()
|
|
138
|
+
});
|
|
139
|
+
</script>
|
|
140
|
+
```
|
|
141
|
+
|
|
23
142
|
ちなみに、controllerはこちらになります。
|
|
24
143
|
```
|
|
25
144
|
class GoodthingController < BaseController
|