Reputation: 6639
In my User controller, I have the following:
class UsersController < ApplicationController
.....
def system_users
@users = User.all
respond_to do |format|
format.html # system_users.html.erb
format.json { render json: @user }
end
end
def edit_system_user
@user = User.find(params[:id])
respond_to do |format|
format.html # edit_system_user.html.erb
format.json { render json: @user }
end
end
In my views/users/system_users.html.erb, I have:
<% @users.each do |user| %>
<tr class="<%= cycle("odd", "even") %>">
<td><%= link_to user["first"], edit_system_user_path(user["id"]) %></td>
<td><%= user["last"] %></td>
<td><%= user["email"] %></td>
<% end %>
In my routes, I have:
edit_system_user /edit_system_user(.:format) user#edit_system_user
But, when I click on the link in the actual view generated by views/users/system_users.html.erb, I get the following error message:
uninitialized constant UserController
My user controller is pluralized, so where is the UserController coming from? Shouldn't it be going to the UsersController?
Upvotes: 0
Views: 154
Reputation: 926
Your routes file is incorrect. It should say "users#edit_system_user" not "user#edit_system_user"
Upvotes: 1