enjaku enjaku - 3 months ago 8
Ruby Question

can't generate show path

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

Answer

try this:

link_to list.name, admin_mass_scan_list_path(list)