bug(rails): fix incompatibility with Rails 5

This commit is contained in:
Joseph Mastey
2017-09-18 20:08:02 -05:00
parent 9fc05eacde
commit ca9ddb6a14
2 changed files with 7 additions and 2 deletions
+6 -1
View File
@@ -9,7 +9,7 @@ class AdminController < ApplicationController
if params[:field].nil? if params[:field].nil?
fields = "*" fields = "*"
else else
fields = params[:field].map {|k,v| k }.join(",") fields = custom_fields.join(",")
end end
if params[:ip] if params[:ip]
@@ -61,6 +61,11 @@ class AdminController < ApplicationController
private private
def custom_fields
params.require(:field).keys
end
helper_method :custom_fields
def admin_param def admin_param
params[:admin_id] != '1' params[:admin_id] != '1'
end end
+1 -1
View File
@@ -10,7 +10,7 @@
<thead> <thead>
<tr> <tr>
<% <%
count = (params[:field] ? (params[:field].count+1) : 6) count = (params[:field] ? (custom_fields.count+1) : 6)
count.times do %> count.times do %>
<th>&nbsp;</th> <th>&nbsp;</th>
<% end %> <% end %>