Я пытаюсь сделать приложение в Rails 4.
У меня промышленная модель.
Я пытаюсь составить указатель отраслей и перечислить их в алфавитном порядке.
У меня есть industry.rb с:
scope :alphabetically, order("sector ASC")
У меня есть контроллер индекса с:
def index
@industries = Industry.alphabetically
end
В моем индексном представлении у меня есть:
<% @industries.each do |industry| %>
<tr>
<td><%= image_tag industry.icon.tiny.url %></td>
<td><%= industry.sector %></td>
<td><%= link_to 'Show', industry %></td>
<td><%= link_to 'Edit', edit_industry_path(industry) %></td>
<td><%= link_to 'Destroy', industry, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
Когда я пытаюсь это сделать, я получаю эту ошибку:
ArgumentError in IndustriesController#index
The scope body needs to be callable.
Как сделать область «вызываемой»?