我的提交者模型中的记录显示在应用程序索引视图中,显示在如下表中。只有我希望能够单击为 列出的号码.count()
并被带到我的门票索引视图,其中列出了所有相应的记录(门票)。
我无法理解如何将实例变量链接到控制器的操作,以便使用我的视图布局。
有任何想法吗?
<table>
<tr>
<th>Name</th>
<th>Number of Tickets</th>
</th>
<tr>
<% Submitter.where(:school_id => current_user.school_id, :disabled => false).each do |sub| %>
<td><%= link_to sub.full_name, edit_submitter_path(sub) %></td>
<td><%= Ticket.where(:submitter_id => sub).count %></td>
</tr>
<% end %>
</table>
路线.rb
resources :feedbacks
resources :products
get "password_resets/new"
get 'signup', to: 'users#new', as: 'signup'
get 'login', to: 'sessions#new', as: 'login'
get 'logout', to: 'sessions#destroy', as: 'logout'
resources :users
resources :sessions
resources :password_resets
resources :mailing_lists
resources :submitters
resources :emails
resources :notes
resources :reminders
resources :descriptions
resources :issues
resources :locations
resources :schools
resources :tickets
root :to => "application#index"