Reputation: 346
I have a controller:
class Admin::MassScanListsController < ApplicationController
def index
@mass_scan_lists = MassScanList.all
end
def show
end
end
an appropriate simple model MassScanList
and a view, where I want to list all my MassScanLists with links to show their content:
- if @mass_scan_lists.present?
- @mass_scan_lists.each do |list|
tr
td= list.id
td= link_to list.name, list
td= list.enabled
I get an error undefined method 'mass_scan_list_path'
which is I suppose I can understand, it must be admin_mass_scan_list_path
, because my controller is Admin::MassScanListsController
and not MassScanListsController
. Bot how can I generate a show path in my case?
P.S.
In my routes.rb
I have:
constraints admins_constraint do
namespace 'admin' do
resources :mass_scan_lists, only: [:index, :show]
end
end
Upvotes: 0
Views: 34
Reputation: 4615
try this:
link_to list.name, admin_mass_scan_list_path(list)
Upvotes: 2