レールでソートテーブルを作成していて、エラーが発生しています。これは私の index.html.erb です
<table>
<tr>
<th><%= sortable "name" %></th>
<th><%= sortable "city" %></th>
<th><%= sortable "country" %></th>
<th><%= sortable "street_address" %></th>
<th><%= sortable "sector" %></th>
<th><%= sortable "telephone" %></th>
<th><%= sortable "fax" %></th>
</tr>
<% for company in @companies %>
<tr>
<td><%= company.name %></td>
<td><%= company.city %></td>
<td><%= company.country %></td>
<td><%= company.street_address %></td>
<td><%= company.sector %></td>
<td><%= company.telephone %></td>
<td><%= company.fax %></td>
</tr>
<% end %>
</table>
これは私の company_controller です
def index
@companies = Company.order(params[:sort] + ' ' + params[:direction])
end
これは私のapplication_helperです
def sortable(column, title = nil)
title ||= column.titleize
direction = (column == params[:sort] && params[:direction] == "asc") ? "desc" : "asc"
link_to title, :sort => column, :direction => direction
end
エラーは次のとおりです。
NoMethodError in CompaniesController#index
undefined method `+' for nil:NilClass
app/controllers/companies_controller.rb:21:in `index'
何が問題で、どうすれば修正できますか?