rtacconi
rtacconi

Reputation: 14769

Rails namespace helpers not working

In app/controllers/admin I created dashboad_controller.rb:

class Admin::DashboardController < ApplicationController

  def index
  end
end

From 'rake routes | grep activity' I get:

            admin_activity_logs GET    /admin/activity_logs(.:format)               {:action=>"index", :controller=>"admin/activity_logs"}

and other routes. My route.rb looks like this:

  namespace :admin do
    resources :activity_logs
  end

When I try to create a link using the helper:

= link_to 'Activity Log', admin_activity_logs

I get

undefined local variable or method `admin_activity_logs' for #<#<Class:0x106077ec8>:0x1060760c8>

Why?

Upvotes: 2

Views: 1611

Answers (1)

Simone Carletti
Simone Carletti

Reputation: 176372

You forgot the _path.

= link_to 'Activity Log', admin_activity_logs_path

Upvotes: 3

Related Questions